This repository was archived by the owner on Apr 10, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
Plugin Development
Benny Neugebauer edited this page Feb 6, 2015
·
2 revisions
C:\Program Files\glassfish-4.1
C:\Program Files\NetBeans 8.0.1
C:\Users\Benny\.nbi
C:\Users\Benny\.netbeans-derby
C:\Users\Benny\AppData\Roaming\NetBeans
import org.openide.filesystems.FileObject;
...
FileObject fo ...
Object value = fo.getAttribute("myKey");
if (value != null) {
...
} DataObject dataObject = ...;
FileObject fo = dataObject.getPrimaryFile();
FileLock lock = FileLock.NONE;
try {
if (!fo.isLocked()) {
BufferedOutputStream os = new BufferedOutputStream(fo.getOutputStream(lock));
os.write("Hello World".getBytes("ASCII"));
os.flush();
os.close();
}
} catch (IOException ex) {
Exceptions.printStackTrace(ex);
return false;
} finally {
lock.releaseLock();
}Reformat reformat = Reformat.get(document);
reformat.lock();
reformat.reformat(0, document.getLength());
reformat.unlock();Preferences codeStyle = CodeStylePreferences.get(file, file.getMIMEType()).getPreferences();
codeStyle.putInt(SimpleValueNames.INDENT_SHIFT_WIDTH, 2);
codeStyle.flush();