本文整理汇总了Java中org.openide.loaders.DataObject.delete方法的典型用法代码示例。如果您正苦于以下问题:Java DataObject.delete方法的具体用法?Java DataObject.delete怎么用?Java DataObject.delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openide.loaders.DataObject
的用法示例。
在下文中一共展示了DataObject.delete方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: actionPerformed
import org.openide.loaders.DataObject; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
HintMetadata hint = this.hint;
try {
if (hint==null) {
hint = getSelectedHint();
}
if (hint == null) {
return;
}
DataObject d = getDataObject(hint);
if (d == null) {
return;
}
if (JOptionPane.YES_OPTION ==
JOptionPane.showConfirmDialog(errorTree,
NbBundle.getMessage(HintsPanel.class, "MSG_DeleteConfirmMessage", hint.displayName ),
NbBundle.getMessage(HintsPanel.class, "MSG_DeleteConfirmTitle"),
JOptionPane.YES_NO_OPTION)) {
d.delete();
RulesManager.getInstance().reload();
cpBased.reset();
//errorTreeModel.removeNodeFromParent(node);
errorTreeModel = constructTM(Utilities.getBatchSupportedHints(cpBased).keySet(), false);
setModel(errorTreeModel);
if (logic != null) {
logic.errorTreeModel = errorTreeModel;
}
hasNewHints = true;
}
} catch (IOException ex) {
Exceptions.printStackTrace(ex);
}
}
示例2: removeDocument
import org.openide.loaders.DataObject; //导入方法依赖的package包/类
/**
* Removes the DataObject with the given name. The name of a resource is
* a "/"-separated path name that identifies the resource or Nbfs URL.
*/
public static boolean removeDocument(String name) throws IOException {
DataObject dataObject = findDataObject(name);
if (dataObject != null) {
dataObject.delete();
return true;
} else {
return false;
}
}
示例3: clearBrokenShadows
import org.openide.loaders.DataObject; //导入方法依赖的package包/类
/**
* Removes references to nonexistent files.
* Package-private for tests.
*/
void clearBrokenShadows() throws IOException {
DataFolder f = FavoritesNode.getFolder();
DataObject [] arr = f.getChildren();
for (DataObject obj : arr) {
if (! (obj instanceof DataShadow)) {
obj.delete();
}
}
}
示例4: remove
import org.openide.loaders.DataObject; //导入方法依赖的package包/类
/**
* Removes given file objects from Favorites if they are found as roots.
* Files that are not found are silently ignored.
* @param toRemove file objects to be removed.
* @throws IOException When corresponding entry in userdir could not be deleted
* @throws NullPointerException When any of <code>toRemove</code> parameters
* is <code>null</code>. It is undefined whether some of other non-null
* parameters were removed or not.
*/
public synchronized void remove(FileObject... toRemove) throws IOException, NullPointerException {
DataFolder f = FavoritesNode.getFolder();
DataObject [] arr = f.getChildren();
for (DataObject obj : arr) {
if (obj instanceof DataShadow) {
FileObject root = ((DataShadow) obj).getOriginal().getPrimaryFile();
for (FileObject rem : toRemove) {
if (rem.equals(root)) {
obj.delete();
}
}
}
}
}
示例5: performAction
import org.openide.loaders.DataObject; //导入方法依赖的package包/类
/**
* Removes the links.
*
* @param arr gives array of actually activated nodes.
*/
@Override
protected void performAction (Node[] arr) {
for (int i = 0; i < arr.length; i++) {
DataObject shad = arr[i].getCookie(DataObject.class);
if (shad != null && shad.getFolder() == FavoritesNode.getFolder()) {
try {
shad.delete();
} catch (IOException ex) {
LOG.log(Level.WARNING, null, ex);
}
}
}
}
示例6: delete
import org.openide.loaders.DataObject; //导入方法依赖的package包/类
private void delete(File file) throws IOException {
DataObject dao = DataObject.find(FileUtil.toFileObject(file));
dao.delete();
}
示例7: delete
import org.openide.loaders.DataObject; //导入方法依赖的package包/类
private void delete(File file) throws IOException {
DataObject dao = DataObject.find(FileUtil.toFileObject(file));
dao.delete();
}
示例8: delete
import org.openide.loaders.DataObject; //导入方法依赖的package包/类
protected void delete(File file) throws IOException {
DataObject dao = DataObject.find(FileUtil.toFileObject(file));
dao.delete();
}
示例9: deleteData
import org.openide.loaders.DataObject; //导入方法依赖的package包/类
protected void deleteData(String path) {
try {
DataObject dao = TestUtil.THIS.findData(path);
if (dao != null) dao.delete();
} catch (Exception ex) {}
}
示例10: testCreateXML
import org.openide.loaders.DataObject; //导入方法依赖的package包/类
public void testCreateXML() throws Exception {
String content
= "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n"
+ "<root/>\n";
try {
// delete document if exists
DataObject dao = TestUtil.THIS.findData(DOCUMENT_NAME + '.' + XML_EXT);
if (dao != null) dao.delete();
// create new Data Object
DataFolder dataFolder = DataFolder.findFolder(TestUtil.THIS.findData("").getPrimaryFile());
XMLDataObject xmlDataObject = (XMLDataObject) TestUtil.createDataObject(dataFolder, DOCUMENT_NAME, XML_EXT, content);
TreeEditorCookie cake = (TreeEditorCookie) xmlDataObject.getCookie(TreeEditorCookie.class);
TreeDocument document = (TreeDocument) cake.openDocumentRoot();
// Create Document Type
DTDDataObject dtdDataObject = (DTDDataObject) TestUtil.THIS.findData(INTERNAL_DTD);
cake = (TreeEditorCookie) dtdDataObject.getCookie(TreeEditorCookie.class);
TreeDTD treeDTD = (TreeDTD) cake.openDocumentRoot();
TreeDocumentType docType = new TreeDocumentType(DOCUMENT_NAME);
docType.setSystemId(DTD_SYS_ID);
TreeChild child = treeDTD.getFirstChild();
while (child != null) {
docType.appendChild((TreeChild) child.clone());
child = child.getNextSibling();
}
document.setDocumentType(docType);
// Create document
TreeElement root = document.getDocumentElement();
// Create root node
root.addAttribute(new TreeAttribute("manager", "Tom Jerry"));
root.addAttribute("id", "a");
// Create node Product
TreeElement product = new TreeElement("Product");
root.appendChild(product);
root.appendChild(new TreeText("\n"));
product.addAttribute("isbn", "123456");
product.addAttribute(new TreeAttribute("id", "b"));
product.appendChild(new TreeText("\nXML Book\n"));
// Create node Descript
TreeElement descript = new TreeElement("Descript");
product.appendChild(descript);
product.appendChild(new TreeText("\n"));
descript.addAttribute("lang", "Eng");
descript.appendChild(new TreeText("\n"));
descript.appendChild(new TreeText("The book describe how is using XML in"));
descript.appendChild(new TreeText("\n"));
descript.appendChild(new TreeGeneralEntityReference("company"));
descript.appendChild(new TreeText("from "));
descript.appendChild(new TreeGeneralEntityReference("cz"));
descript.appendChild(new TreeText("\n"));
descript.appendChild(new TreeText("Very important is author\n"));
descript.appendChild(new TreeGeneralEntityReference("notice"));
descript.appendChild(new TreeText("\n"));
TestUtil.saveDataObject(xmlDataObject);
ref(TestUtil.nodeToString(document));
compareReferenceFiles();
} catch (Exception ex) {
log("\nCreating XML fails due:\n", ex);
ex.printStackTrace();
fail("\nCreating XML fails due:\n" + ex);
}
}
示例11: deleteDO
import org.openide.loaders.DataObject; //导入方法依赖的package包/类
private void deleteDO (File toDelete) throws DataObjectNotFoundException, IOException {
DataObject dao = DataObject.find(FileUtil.toFileObject(toDelete));
dao.delete();
}
示例12: testTransformation
import org.openide.loaders.DataObject; //导入方法依赖的package包/类
/** Performs 'XSL Transformation...' action and checks output. */
public void testTransformation() throws Exception {
final String OUT_FILE = "../out/document.html";
//final String OUT_FILE = "output.html"; //!!!
final String OUT_NODE = "out" + DELIM + "document";
//final String OUT_NODE = "sources" + DELIM + "output"; //!!!
// clear output and display Transformation Dialog
DataObject dao = TestUtil.THIS.findData("out/document.html");
if (dao != null) /* then */ dao.delete();
XSLTransformationDialog dialog = transformXML("sources" + DELIM + "document");
// fill in the TransformationDialog and execute transformation
dialog.cboXSLTScript().clearText();
dialog.cboXSLTScript().typeText("../styles/doc2html.xsl");
dialog.cboXSLTScript().pressKey(KeyEvent.VK_TAB);
dialog.cboOutput().clearText();
dialog.cboOutput().typeText(OUT_FILE);
dialog.cboJComboBox().selectItem(dialog.ITEM_DONOTHING);
dialog.oK();
// check the transformation's output
char[] cbuf = new char[4000];
Node htmlNode = findDataNode(OUT_NODE);
new OpenAction().perform(htmlNode);
// force editor to reload document
EditorWindowOperator ewo = new EditorWindowOperator();
EditorOperator eo = ewo.getEditor(htmlNode.getText());
eo.setCaretPositionToLine(1);
eo.insert("\n");
eo.waitModified(true);
eo.deleteLine(1);
eo.save();
String substring = "<h1>Testing Document</h1>";
boolean result = eo.getText().indexOf(substring) != -1;
assertTrue("Cannot find control substring:\n" + substring, (result));
//ewo.close(); //!!! on test machines throws JemmyException: Exception in setClosed
}