本文整理汇总了Java中org.openide.modules.Modules类的典型用法代码示例。如果您正苦于以下问题:Java Modules类的具体用法?Java Modules怎么用?Java Modules使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Modules类属于org.openide.modules包,在下文中一共展示了Modules类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: addModuleInfo
import org.openide.modules.Modules; //导入依赖的package包/类
private void addModuleInfo(final Project prj) {
final ModuleInfo info = Modules.getDefault().ownerOf(prj.getClass());
if (info != null) {
// is null in tests..
MUTEX.writeAccess(new Mutex.Action<Void>() {
public @Override Void run() {
if (!openProjectsModuleInfos.containsKey(info)) {
openProjectsModuleInfos.put(info, new ArrayList<Project>());
info.addPropertyChangeListener(infoListener);
}
openProjectsModuleInfos.get(info).add(prj);
return null;
}
});
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:OpenProjectList.java
示例2: closing
import org.openide.modules.Modules; //导入依赖的package包/类
boolean closing(List<? extends ModuleInfo> modules) {
for (Callable<?> c : onStop().lookupAll(Callable.class)) { // NOI18N
if (!modules.contains(Modules.getDefault().ownerOf(c.getClass()))) {
continue;
}
try {
if (Boolean.FALSE.equals(c.call())) {
Util.err.log(Level.FINE, "{0} refused to close", c.getClass()); // NOI18N
return false;
}
} catch (Exception ex) {
Util.err.log(Level.FINE, c.getClass() + " thrown an exception", ex); // NOI18N
return false;
}
}
return true;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:NbStartStop.java
示例3: testStopping
import org.openide.modules.Modules; //导入依赖的package包/类
public void testStopping() {
final boolean[] ok = { false };
onStartStop.initialize();
onStartStop.waitOnStart();
final Callable<Boolean> run = new Callable<Boolean>() {
@Override public Boolean call() {
return ok[0] = true;
}
};
stop.add(run);
List<ModuleInfo> modules = Collections.singletonList(Modules.getDefault().ownerOf(run.getClass()));
assertTrue("Close approved", onStartStop.closing(modules));
assertTrue("Initialized", ok[0]);
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:NbStartStopTest.java
示例4: testStoppingFalse
import org.openide.modules.Modules; //导入依赖的package包/类
public void testStoppingFalse() {
final boolean[] ok = { false };
onStartStop.initialize();
onStartStop.waitOnStart();
final Callable<Boolean> run = new Callable<Boolean>() {
@Override public Boolean call() {
ok[0] = true;
return false;
}
};
stop.add(run);
List<ModuleInfo> modules = Collections.singletonList(Modules.getDefault().ownerOf(run.getClass()));
assertFalse("Close rejected", onStartStop.closing(modules));
assertTrue("Initialized", ok[0]);
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:NbStartStopTest.java
示例5: testStop
import org.openide.modules.Modules; //导入依赖的package包/类
public void testStop() {
final boolean[] ok = { false };
onStartStop.initialize();
onStartStop.waitOnStart();
final Runnable run = new Runnable() {
@Override public void run() {
ok[0] = true;
}
};
stop.add(run);
List<ModuleInfo> modules = Collections.singletonList(Modules.getDefault().ownerOf(run.getClass()));
for (Task t : onStartStop.startClose(modules)) {
t.waitFinished();
}
assertTrue("Initialized", ok[0]);
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:NbStartStopTest.java
示例6: setPreferredLoader
import org.openide.modules.Modules; //导入依赖的package包/类
/** Utility method to mark a file as belonging to a loader.
* When the file is to be recognized this loader will be used first.
*
* @param fo file to mark
* @param loader the loader to assign to the file or null if previous
* association should be cleared
* @exception IOException if setting the file's attribute failed
*/
public static void setPreferredLoader (FileObject fo, DataLoader loader)
throws IOException {
DataLoader prev = getPreferredLoader (fo);
if (prev == loader) {
return;
}
if (loader == null) {
fo.setAttribute(DataObject.EA_ASSIGNED_LOADER, null);
} else {
Class c = loader.getClass();
fo.setAttribute (DataObject.EA_ASSIGNED_LOADER, c.getName ());
ModuleInfo module = Modules.getDefault().ownerOf(c);
if (module != null) {
fo.setAttribute(DataObject.EA_ASSIGNED_LOADER_MODULE, module.getCodeNameBase());
}
}
Set<FileObject> one = new HashSet<FileObject>();
one.add(fo);
if (!DataObjectPool.getPOOL().revalidate(one).isEmpty()) {
DataObject.LOG.log(Level.FINE, "It was not possible to invalidate data object: {0}", fo); // NOI18N
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:33,代码来源:DataLoaderPool.java
示例7: AboutPanel
import org.openide.modules.Modules; //导入依赖的package包/类
public AboutPanel() {
initComponents();
final ModuleInfo info = Modules.getDefault().findCodeNameBase("com.igormaznitsa.nbmindmap");
final String version;
if (info == null) {
version = "UNKNOWN";
}
else {
version = info.getImplementationVersion();
}
final Properties props = new Properties();
props.setProperty("version", version);
this.textLabel.replaceMacroses(props);
this.textLabel.addLinkListener(this);
this.textLabel.setShowLinkAddressInTooltip(true);
}
开发者ID:raydac,项目名称:netbeans-mmd-plugin,代码行数:19,代码来源:AboutPanel.java
示例8: createVersionPanel
import org.openide.modules.Modules; //导入依赖的package包/类
private JPanel createVersionPanel() {
final JPanel panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.LINE_AXIS));
final ModuleInfo moduleInfo = Modules.getDefault().ownerOf(S2tbxAboutBox.class);
panel.add(new JLabel("<html><b>Sentinel-2 Toolbox (S2TBX) version " + moduleInfo.getImplementationVersion() + "</b>",
SwingConstants.RIGHT));
final URI releaseNotesURI = getReleaseNotesURI();
if (releaseNotesURI != null) {
final JLabel releaseNoteLabel = new JLabel("<html><a href=\"" + releaseNotesURI.toString() + "\">Release Notes</a>",
SwingConstants.RIGHT);
releaseNoteLabel.setCursor(new Cursor(Cursor.HAND_CURSOR));
releaseNoteLabel.addMouseListener(new BrowserUtils.URLClickAdaptor(releaseNotesHTTP));
panel.add(releaseNoteLabel);
}
return panel;
}
开发者ID:senbox-org,项目名称:s2tbx,代码行数:17,代码来源:S2tbxAboutBox.java
示例9: setUp
import org.openide.modules.Modules; //导入依赖的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);
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:MavenProjectPropsImplTest.java
示例10: beforeLookup
import org.openide.modules.Modules; //导入依赖的package包/类
@Override
protected void beforeLookup(Lookup.Template templ) {
if (Boolean.TRUE.equals(changing.get())) {
return;
}
Class type = templ.getType();
// Force module system to be initialize by looking up ModuleInfo or Modules.
// Good for unit tests, etc.
if (!started && (type == ModuleInfo.class || type == Module.class || type == Modules.class)) {
Main.getModuleSystem ();
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:MainLookup.java
示例11: startClose
import org.openide.modules.Modules; //导入依赖的package包/类
List<Task> startClose(List<? extends ModuleInfo> modules) {
List<Task> waitFor = new ArrayList<Task>();
for (Runnable r : onStop().lookupAll(Runnable.class)) { // NOI18N
if (!modules.contains(Modules.getDefault().ownerOf(r.getClass()))) {
continue;
}
waitFor.add(RP.post(r));
}
return waitFor;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:NbStartStop.java
示例12: testCannotLoadAsmClass
import org.openide.modules.Modules; //导入依赖的package包/类
public void testCannotLoadAsmClass() {
ModuleInfo module = Modules.getDefault().findCodeNameBase("org.netbeans.core");
final ClassLoader loader = module.getClassLoader();
Class<?> clazz;
try {
clazz = Class.forName("org.objectweb.asm.ClassReader", true, loader);
} catch (ClassNotFoundException ex) {
// OK
return;
}
fail("Loaded " + clazz + " from " + clazz.getClassLoader() + " via " + loader);
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:CannotFindAsmTest.java
示例13: findCNBForClass
import org.openide.modules.Modules; //导入依赖的package包/类
public static String findCNBForClass(@NonNull Class<?> cls) {
String absolutePath;
ModuleInfo owner = Modules.getDefault().ownerOf(cls);
if (owner != null) {
absolutePath = owner.getCodeNameBase();
} else {
absolutePath = cls.getName().replaceFirst("(^|\\.)[^.]+$", "");//NOI18N
}
return absolutePath.replace('.', '-');
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:AuxiliaryConfigBasedPreferencesProvider.java
示例14: getVersion
import org.openide.modules.Modules; //导入依赖的package包/类
public static String getVersion() {
if (VERSION == null) {
ModuleInfo info = Modules.getDefault().findCodeNameBase(CODE_NAME_BASE);
VERSION = info.getSpecificationVersion().toString();
}
return VERSION;
}
开发者ID:codic-project,项目名称:codic-netbeans-plugin,代码行数:8,代码来源:CodicUtils.java
示例15: PfaAboutBox
import org.openide.modules.Modules; //导入依赖的package包/类
public PfaAboutBox() {
super(new BorderLayout(4, 4));
setBorder(new EmptyBorder(4, 4, 4, 4));
ModuleInfo moduleInfo = Modules.getDefault().ownerOf(PfaAboutBox.class);
ImageIcon aboutImage = new ImageIcon(PfaAboutBox.class.getResource("about_pfa.jpg"));
JLabel iconLabel = new JLabel(aboutImage);
add(iconLabel, BorderLayout.CENTER);
add(new JLabel("<html><b>ESA PFA version " + moduleInfo.getImplementationVersion() + "</b>", SwingConstants.RIGHT), BorderLayout.SOUTH);
}
开发者ID:bcdev,项目名称:esa-pfa,代码行数:10,代码来源:PfaAboutBox.java
示例16: getModuleName
import org.openide.modules.Modules; //导入依赖的package包/类
private String getModuleName(Class<?> c) {
ModuleInfo info = Modules.getDefault().ownerOf(c);
return info != null ? info.getDisplayName() : "Unknown"; //NOI18N
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:AbstractRefactoring.java
示例17: removeModuleInfo
import org.openide.modules.Modules; //导入依赖的package包/类
private void removeModuleInfo(Project prj) {
removeModuleInfo(prj, Modules.getDefault().ownerOf(prj.getClass()));
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:OpenProjectList.java
示例18: notInstalled
import org.openide.modules.Modules; //导入依赖的package包/类
private static boolean notInstalled(@NonNull final String cnb) {
final ModuleInfo module = Modules.getDefault().findCodeNameBase(cnb);
return module == null;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:MissingModuleProblemsProvider.java
示例19: write
import org.openide.modules.Modules; //导入依赖的package包/类
public void write(java.io.Writer w, Object inst) throws java.io.IOException {
XMLSettingsSupport.storeToXML10(inst, w, Modules.getDefault().ownerOf(inst.getClass()));
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:XMLSettingsSupport.java
示例20: SnapAboutBox
import org.openide.modules.Modules; //导入依赖的package包/类
public SnapAboutBox() {
super(new BorderLayout(4, 4));
ModuleInfo desktopModuleInfo = Modules.getDefault().ownerOf(SnapAboutBox.class);
ModuleInfo engineModuleInfo = Modules.getDefault().ownerOf(Product.class);
ImageIcon image = new ImageIcon(SnapAboutBox.class.getResource("SNAP_Banner.png"));
JLabel banner = new JLabel(image);
versionText = new JLabel("<html><b>SNAP " + SystemUtils.getReleaseVersion() + "</b>");
JLabel infoText = new JLabel("<html>"
+ "This program is free software: you can redistribute it and/or modify it<br>"
+ "under the terms of the <b>GNU General Public License</b> as published by<br>"
+ "the Free Software Foundation, either version 3 of the License, or<br>"
+ "(at your option) any later version.<br>"
+ "<br>"
+ "<b>SNAP Desktop implementation version: </b>" + desktopModuleInfo.getImplementationVersion() + "<br>"
+ "<b>SNAP Engine implementation version: </b>" + engineModuleInfo.getImplementationVersion() + "<br>"
/*
+ "<b>Home directory: </b>" + SystemUtils.getApplicationHomeDir() + "<br>"
+ "<b>User directory: </b>" + SystemUtils.getApplicationDataDir() + "<br>"
+ "<b>Cache directory: </b>" + SystemUtils.getCacheDir() + "<br>"
*/
+ "<b>JRE: </b>" + System.getProperty("java.runtime.name") + " " + System.getProperty("java.runtime.version") + "<br>"
+ "<b>JVM: </b>" + System.getProperty("java.vm.name") + " by " + System.getProperty("java.vendor") + "<br>"
+ "<b>Memory: </b>" + Math.round(Runtime.getRuntime().maxMemory() / 1024. / 1024.) + " MiB<br>"
);
Font font = versionText.getFont();
if (font != null) {
infoText.setFont(font.deriveFont(font.getSize() * 0.9f));
}
JPanel innerPanel = new JPanel(new BorderLayout(4, 4));
innerPanel.add(createVersionPanel(), BorderLayout.NORTH);
innerPanel.add(infoText, BorderLayout.SOUTH);
add(banner, BorderLayout.WEST);
add(innerPanel, BorderLayout.CENTER);
/*
final Properties properties = System.getProperties();
for (String name : properties.stringPropertyNames()) {
System.out.println(name + " = " + properties.getProperty(name));
}
*/
}
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:45,代码来源:SnapAboutBox.java
注:本文中的org.openide.modules.Modules类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论