Java Code Examples for org.openide.cookies.CloseCookie#close()
The following examples show how to use
org.openide.cookies.CloseCookie#close() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultDataObjectHasOpenTest.java From netbeans with Apache License 2.0 | 6 votes |
@Override protected void tearDown() throws Exception { waitForAWT(); DD.disableTest = true; super.tearDown(); if (obj != null) { CloseCookie cc; cc = obj.getCookie(CloseCookie.class); if (cc != null) { DD.toReturn = NotifyDescriptor.NO_OPTION; cc.close(); } } waitForAWT(); }
Example 2
Source File: XMLDataObjectMimeTypeTest.java From netbeans with Apache License 2.0 | 6 votes |
protected void tearDown() throws Exception { waitForAWT(); DD.disableTest = true; super.tearDown(); if (obj != null) { CloseCookie cc; cc = obj.getCookie(CloseCookie.class); if (cc != null) { DD.toReturn = NotifyDescriptor.NO_OPTION; cc.close(); } } Repository.getDefault().removeFileSystem(lfs); waitForAWT(); }
Example 3
Source File: Utilities.java From netbeans with Apache License 2.0 | 5 votes |
@NonNull static FileObject copyBuildScript (@NonNull final Project project) throws IOException { final FileObject projDir = project.getProjectDirectory(); FileObject rpBuildScript = projDir.getFileObject(BUILD_SCRIPT_PATH); if (rpBuildScript != null && !isBuildScriptUpToDate(project)) { // try to close the file just in case the file is already opened in editor DataObject dobj = DataObject.find(rpBuildScript); CloseCookie closeCookie = dobj.getLookup().lookup(CloseCookie.class); if (closeCookie != null) { closeCookie.close(); } final FileObject nbproject = projDir.getFileObject("nbproject"); //NOI18N final FileObject backupFile = nbproject.getFileObject(BUILD_SCRIPT_BACK_UP, "xml"); //NOI18N if (backupFile != null) { backupFile.delete(); } FileUtil.moveFile(rpBuildScript, nbproject, BUILD_SCRIPT_BACK_UP); rpBuildScript = null; } if (rpBuildScript == null) { if (LOG.isLoggable(Level.FINE)) { LOG.log( Level.FINE, "Updating remote build script in project {0} ({1})", //NOI18N new Object[]{ ProjectUtils.getInformation(project).getDisplayName(), FileUtil.getFileDisplayName(projDir) }); } rpBuildScript = FileUtil.createData(project.getProjectDirectory(), BUILD_SCRIPT_PATH); try( final InputStream in = new BufferedInputStream(RemotePlatformProjectSaver.class.getResourceAsStream(BUILD_SCRIPT_PROTOTYPE)); final OutputStream out = new BufferedOutputStream(rpBuildScript.getOutputStream())) { FileUtil.copy(in, out); } } return rpBuildScript; }
Example 4
Source File: JWSProjectPropertiesUtils.java From netbeans with Apache License 2.0 | 5 votes |
public static boolean copyJnlpImplTemplate(Project proj) throws IOException { boolean res = false; final FileObject projDir = proj.getProjectDirectory(); FileObject jnlpBuildFile = projDir.getFileObject(JNLP_BUILD_IMPL_PATH); if (jnlpBuildFile != null && !isJnlpImplUpToDate(proj)) { // try to close the file just in case the file is already opened in editor DataObject dobj = DataObject.find(jnlpBuildFile); CloseCookie closeCookie = dobj.getLookup().lookup(CloseCookie.class); if (closeCookie != null) { closeCookie.close(); } final FileObject nbproject = projDir.getFileObject("nbproject"); //NOI18N final FileObject backupFile = nbproject.getFileObject("jnlp-impl_backup", "xml"); //NOI18N if (backupFile != null) { backupFile.delete(); } FileUtil.moveFile(jnlpBuildFile, nbproject, "jnlp-impl_backup"); //NOI18N jnlpBuildFile = null; } if (jnlpBuildFile == null) { FileObject templateFO = FileUtil.getConfigFile(BUILD_TEMPLATE); if (templateFO != null) { FileUtil.copyFile(templateFO, projDir.getFileObject("nbproject"), "jnlp-impl"); // NOI18N } res = true; } return res; }
Example 5
Source File: DefaultDataObjectHasNodeInLookupTest.java From netbeans with Apache License 2.0 | 5 votes |
@Override protected void tearDown() throws Exception { waitForAWT(); super.tearDown(); if (obj != null) { CloseCookie cc; cc = obj.getCookie(CloseCookie.class); if (cc != null) { cc.close(); } } waitForAWT(); }
Example 6
Source File: Group.java From netbeans with Apache License 2.0 | 5 votes |
private static void closeDocuments(Set<DataObject> toCloseDocuments) { for (DataObject dobj : toCloseDocuments) { if (!dobj.isModified()) { //the modified files would force user to decide about saving.. CloseCookie cook = dobj.getLookup().lookup(CloseCookie.class); if (cook != null) { cook.close(); } } } }
Example 7
Source File: XMLDataObjectMimeTypeTest.java From netbeans with Apache License 2.0 | 5 votes |
protected void tearDown() throws Exception { waitForAWT(); super.tearDown(); if (obj != null) { CloseCookie cc; cc = obj.getCookie(CloseCookie.class); if (cc != null) { cc.close(); } } Repository.getDefault().removeFileSystem(lfs); waitForAWT(); }
Example 8
Source File: CloseMergeViewAction.java From netbeans with Apache License 2.0 | 5 votes |
protected void performAction(org.openide.nodes.Node[] node) { if (node.length == 0) return; CloseCookie cc = (CloseCookie) node[0].getCookie (CloseCookie.class); if (cc != null) { cc.close(); } }