本文整理汇总了Java中org.netbeans.api.project.ProjectUtils.getPreferences方法的典型用法代码示例。如果您正苦于以下问题:Java ProjectUtils.getPreferences方法的具体用法?Java ProjectUtils.getPreferences怎么用?Java ProjectUtils.getPreferences使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.netbeans.api.project.ProjectUtils
的用法示例。
在下文中一共展示了ProjectUtils.getPreferences方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: enableWhiteListInProject
import org.netbeans.api.project.ProjectUtils; //导入方法依赖的package包/类
public static void enableWhiteListInProject(@NonNull Project p, final @NonNull String whiteListId, final boolean enable) {
final Preferences prefs = ProjectUtils.getPreferences(p, WhiteListQuery.class, true);
ProjectManager.mutex().writeAccess(new Runnable() {
@Override
public void run() {
prefs.putBoolean(PROP_WHITELIST+whiteListId, enable);
if (enable) {
prefs.putBoolean(PROP_WHITELIST_ENABLED, true);
}
}
});
final Reference<WhiteListLookup> lkpRef = lookupCache.get(p);
final WhiteListLookup lkp;
if (lkpRef != null && (lkp=lkpRef.get())!=null) {
lkp.updateLookup();
}
}
示例2: findHtmlVersion
import org.netbeans.api.project.ProjectUtils; //导入方法依赖的package包/类
private static HtmlVersion findHtmlVersion(Project project, String namespace, boolean xhtml) {
Preferences prefs = ProjectUtils.getPreferences(project, HtmlSourceVersionController.class, true);
String publicId = prefs.get(getPropertyKey(xhtml), null);
if (publicId == null) {
return null;
}
//no-public id versions
if(xhtml && publicId.equals(HtmlVersion.XHTML5.name())) {
return HtmlVersion.XHTML5;
} else if(!xhtml && publicId.equals(HtmlVersion.HTML5.name())) {
return HtmlVersion.HTML5;
}
try {
return HtmlVersion.find(publicId, namespace);
} catch (IllegalArgumentException e) {
//no-op
}
return null;
}
示例3: write
import org.netbeans.api.project.ProjectUtils; //导入方法依赖的package包/类
public static void write(Project project, EclipseProjectReference ref) {
Preferences prefs = ProjectUtils.getPreferences(project, EclipseProjectReference.class, true);
File baseDir = FileUtil.toFile(project.getProjectDirectory());
if (CollocationQuery.areCollocated(baseDir, ref.eclipseProjectLocation)) {
prefs.put("project", PropertyUtils.relativizeFile(baseDir, ref.eclipseProjectLocation)); //NOI18N
} else {
prefs.put("project", ref.eclipseProjectLocation.getPath()); //NOI18N
}
if (ref.eclipseWorkspaceLocation != null) {
if (CollocationQuery.areCollocated(baseDir, ref.eclipseWorkspaceLocation)) {
prefs.put("workspace", PropertyUtils.relativizeFile(baseDir, ref.eclipseWorkspaceLocation)); //NOI18N
} else {
prefs.put("workspace", ref.eclipseWorkspaceLocation.getPath()); //NOI18N
}
}
prefs.put("timestamp", Long.toString(ref.getCurrentTimestamp())); //NOI18N
prefs.put("key", ref.key); //NOI18N
}
示例4: setUp
import org.netbeans.api.project.ProjectUtils; //导入方法依赖的package包/类
protected @Override void setUp() throws Exception {
System.setProperty("org.netbeans.core.startup.ModuleSystem.CULPRIT", "true");
MockLookup.setInstances(new Modules() {
@Override public ModuleInfo ownerOf(Class<?> clazz) {
return null;
}
});
clearWorkDir();
d = FileUtil.toFileObject(getWorkDir());
TestFileUtils.writeFile(d, "pom.xml", "<project><modelVersion>4.0.0</modelVersion><groupId>g</groupId><artifactId>a</artifactId><version>0</version></project>");
prj = ProjectManager.getDefault().findProject(d);
p = ProjectUtils.getPreferences(prj, MavenProjectPropsImplTest.class, true);
}
示例5: getPreferences
import org.netbeans.api.project.ProjectUtils; //导入方法依赖的package包/类
private Preferences getPreferences() {
Preferences prefs = prefsCache.get();
if (prefs == null) {
prefs = ProjectUtils.getPreferences(project, MissingModuleProblemsProvider.class, true);
if (prefsCache.compareAndSet(null, prefs)) {
prefs.addPreferenceChangeListener(WeakListeners.create(PreferenceChangeListener.class, this, prefs));
}
}
return prefs;
}
示例6: setDefaultHtmlVersion
import org.netbeans.api.project.ProjectUtils; //导入方法依赖的package包/类
public static void setDefaultHtmlVersion(Project project, HtmlVersion version, boolean xhtml) {
Preferences prefs = ProjectUtils.getPreferences(project, HtmlSourceVersionController.class, true);
String publicId = version.getPublicID();
if(publicId == null) {
publicId = version.name(); //x/html5 has no public id
}
prefs.put(getPropertyKey(xhtml), publicId);
}
示例7: findProjectPreferences
import org.netbeans.api.project.ProjectUtils; //导入方法依赖的package包/类
private static Preferences findProjectPreferences(FileObject file) {
if (file != null) {
Project p = FileOwnerQuery.getOwner(file);
if (p != null) {
return ProjectUtils.getPreferences(p, IndentUtils.class, true);
}
}
return null;
}
示例8: read
import org.netbeans.api.project.ProjectUtils; //导入方法依赖的package包/类
public static @CheckForNull EclipseProjectReference read(Project project) {
// XXX using shared prefs is incorrect if an absolute path was stored!
Preferences prefs = ProjectUtils.getPreferences(project, EclipseProjectReference.class, true);
String projectLoc = prefs.get("project", null); //NOI18N
if (projectLoc == null) {
return null;
}
return new EclipseProjectReference(project, projectLoc, prefs.get("workspace", null), Long.parseLong(prefs.get("timestamp", null)), prefs.get("key", null)); //NOI18N
}
示例9: findAssociation
import org.netbeans.api.project.ProjectUtils; //导入方法依赖的package包/类
public Association findAssociation(Project project) {
// XXX is using shared metadata appropriate? server may or may not be public...
Preferences prefs = ProjectUtils.getPreferences(project, MetadataProjectHudsonProvider.class, true);
String url = prefs.get(KEY, null);
if (url != null) {
return Association.fromString(url);
} else {
return null;
}
}
示例10: recordAssociation
import org.netbeans.api.project.ProjectUtils; //导入方法依赖的package包/类
public boolean recordAssociation(Project project, Association assoc) {
Preferences prefs = ProjectUtils.getPreferences(project, MetadataProjectHudsonProvider.class, true);
if (assoc != null) {
prefs.put(KEY, assoc.toString());
} else {
prefs.remove(KEY);
}
return true;
}
示例11: prefs
import org.netbeans.api.project.ProjectUtils; //导入方法依赖的package包/类
public static Preferences prefs(Project suiteProject) {
return ProjectUtils.getPreferences(suiteProject, SuiteInstallerProjectProperties.class, true);
}
示例12: isWhiteListPanelEnabled
import org.netbeans.api.project.ProjectUtils; //导入方法依赖的package包/类
static boolean isWhiteListPanelEnabled(@NonNull Project p) {
Preferences prefs = ProjectUtils.getPreferences(p, WhiteListQuery.class, true);
return prefs.getBoolean(PROP_WHITELIST_ENABLED, false);
}
示例13: isWhiteListEnabledInProject
import org.netbeans.api.project.ProjectUtils; //导入方法依赖的package包/类
public static boolean isWhiteListEnabledInProject(@NonNull Project p, @NonNull String whiteListId) {
Preferences prefs = ProjectUtils.getPreferences(p, WhiteListQuery.class, true);
return prefs.getBoolean(PROP_WHITELIST+whiteListId, false);
}
示例14: ProjectPreferencesFactory
import org.netbeans.api.project.ProjectUtils; //导入方法依赖的package包/类
public ProjectPreferencesFactory(Project project) {
this.project = project;
Preferences p = ProjectUtils.getPreferences(project, IndentUtils.class, true);
projectPrefs = ProxyPreferences.getProxyPreferences(this, p);
}
示例15: isKeyOverridenForMimeType
import org.netbeans.api.project.ProjectUtils; //导入方法依赖的package包/类
public boolean isKeyOverridenForMimeType(String key, String mimeType) {
Preferences p = projectPrefs != null ? projectPrefs : ProjectUtils.getPreferences(project, IndentUtils.class, true);
p = p.node(mimeType).node(CODE_STYLE_PROFILE).node(PROJECT_PROFILE);
return p.get(key, null) != null;
}