Refine search
@Override protected PhaseRunner createTask(final FileObject fo) { PhaseRunner pr = null; try { DataObject dobj = DataObject.find(fo); EditorCookie ec = dobj.getCookie(EditorCookie.class); Document doc = ec.getDocument(); if (doc != null) { pr = new SemanticHighlighter(doc); } } catch (DataObjectNotFoundException ex) { ex.printStackTrace(); } return pr != null ? pr : lazyRunner(); }
@Override public void doImport(FileObject importFile) throws IllegalArgumentException { // TODO: let's see if we can push this method impl up to AbstractImportProcessor assert isSupported(importFile) : "unsupported FileObject passed to doImport, check for support first"; try { DataObject dataObject = DataObject.find(importFile); copySourceFiles(dataObject, getMimeTypeImportFolder()); } catch (DataObjectNotFoundException ex) { LOGGER.log(Level.WARNING, "Unable to find dataobject for fileobject {0}", ex.getMessage()); } // </toSuper> // skip automatic processing for now: // process(importFile, project); }
/** * Returns a {@link Source} instance representing given {@link org.openide.filesystems.FileObject}s * and classpath represented by given {@link ClasspathInfo}. * * * @param cpInfo the classpaths to be used. * @param files for which the {@link Source} should be created * @return a new {@link Source} * @throws IllegalArgumentException if fileObject or cpInfo is null */ public static Source create(final ClasspathInfo cpInfo, final Collection<? extends FileObject> files) throws IllegalArgumentException { if (files == null || cpInfo == null) { throw new IllegalArgumentException (); } try { return new Source(cpInfo, files); } catch (DataObjectNotFoundException donf) { Logger.getLogger("global").warning("Ignoring non existent file: " + FileUtil.getFileDisplayName(donf.getFileObject())); //NOI18N } catch (IOException ex) { Exceptions.printStackTrace(ex); } return null; }
FileObject fobj = FileUtil.toFileObject(file); try { dobj = DataObject.find(fobj); } catch (DataObjectNotFoundException ex) { ex.printStackTrace(); Node nodeOfDobj = dobj.getNodeDelegate(); EditorCookie ec = nodeOfDobj.getCookie(EditorCookie.class); try { LineCookie lc = (LineCookie) dobj.getCookie(LineCookie.class); Line.Set lineSet = lc.getLineSet(); Line line = lineSet.getCurrent(NbDocument.findLineNumber(docToGo, offset));
public void actionPerformed(ActionEvent e) { try { DataFolder folder = DataFolder.findFolder(project.getProjectDirectory()); // path to template... FileObject temp = Repository.getDefault().getDefaultFileSystem().findResource("Maven2Templates/profiles.xml"); //NOI18N DataObject dobj = DataObject.find(temp); DataObject newOne = dobj.createFromTemplate(folder); EditCookie cook = newOne.getCookie(EditCookie.class); if (cook != null) { cook.edit(); } } catch (DataObjectNotFoundException ex) { ex.printStackTrace(); } catch (IOException ex) { ex.printStackTrace(); } }
public static LineCookie getLineCookie(final FileObject fo) { LineCookie result = null; try { DataObject dataObject = DataObject.find(fo); if (dataObject != null) { result = dataObject.getLookup().lookup(LineCookie.class); } } catch (DataObjectNotFoundException e) { e.printStackTrace(); } return result; }
/** This method returns an image, which is displayed for the FileObject in the explorer. * It is used to display objects in editor (e.g. in code completion). * @param doc This is the documet, in which the icon will be used (for exmaple for completion). * @param fo file object for which the icon is looking for * @return an Image which is dislayed in the explorer for the file. */ public java.awt.Image getIcon(FileObject fo) { java.awt.Image icon = null; try { icon = DataObject.find(fo).getNodeDelegate().getIcon(java.beans.BeanInfo.ICON_COLOR_16x16); } catch(org.openide.loaders.DataObjectNotFoundException e) { e.printStackTrace(System.out); } return icon; }
protected static void saveFile(final FileObject file) { // Save the file try { DataObject dobj = DataObject.find(file); if (dobj != null) { SaveCookie saveCookie = dobj.getCookie(SaveCookie.class); if (saveCookie != null) { saveCookie.save(); } } } catch (DataObjectNotFoundException donfe) { LOGGER.log(Level.SEVERE, donfe.getLocalizedMessage(), donfe); } catch (IOException ioe) { LOGGER.log(Level.SEVERE, ioe.getLocalizedMessage(), ioe); } }
@Override public void run() { try { File file = saveToTempFile(); String contentType = getContentType(); if ("image/png".equals(contentType) //NOI18N || "image/gif".equals(contentType) //NOI18N || "image/jpeg".equals(contentType)) { //NOI18N HtmlBrowser.URLDisplayer.getDefault().showURL(Utilities.toURI(file).toURL()); } else { file = FileUtil.normalizeFile(file); FileObject fob = FileUtil.toFileObject(file); DataObject dob = DataObject.find(fob); OpenCookie open = dob.getCookie(OpenCookie.class); if (open != null) { open.open(); } else { // PENDING } } } catch (DataObjectNotFoundException dnfex) { LOG.log(Level.INFO, dnfex.getMessage(), dnfex); } catch (IOException ioex) { LOG.log(Level.INFO, ioex.getMessage(), ioex); } finally { handle.finish(); } } });
/** * Save a file. * @param fileObject file to save */ public static void saveFile(FileObject fileObject) { assert fileObject != null; try { DataObject dobj = DataObject.find(fileObject); if (dobj != null) { saveFile(dobj); } } catch (DataObjectNotFoundException donfe) { LOGGER.log(Level.SEVERE, donfe.getLocalizedMessage(), donfe); } }
private void readObject (ObjectInputStream ois) throws IOException, ClassNotFoundException { ois.defaultReadObject (); try { DataObject obj = DataObject.find (file); if (obj instanceof MultiDataObject) { MultiDataObject m = (MultiDataObject)obj; if (file.equals (m.getPrimaryFile ())) { // primary entry entry = m.getPrimaryEntry (); } else { // secondary entry Entry e = (Entry)m.findSecondaryEntry (file); if (e == null) { throw new InvalidObjectException (obj.toString ()); } // remember the entry entry = e; } } } catch (DataObjectNotFoundException ex) { throw new InvalidObjectException (ex.getMessage ()); } }
dobj = DataObject.find(fo); } catch (DataObjectNotFoundException ex) { ex.printStackTrace(System.err);
public boolean showSource(SourceFileInfo lineInfo, boolean isReadOnly) { FileObject fo = CndFileUtils.toFileObject(CndFileUtils.normalizeAbsolutePath(lineInfo.getFileName())); try { new ROEditor(fo).open(); } catch (DataObjectNotFoundException e) { e.printStackTrace(); return false; } return true; }
@Override public org.openide.nodes.Node createLogicalView() { try { //Get the Text directory, creating if deleted FileObject projectDirectory = project.getProjectDirectory(); DataFolder farmFolder = DataFolder.findFolder(projectDirectory); FarmManager farmManager = project.getLookup().lookup(FarmManager.class); Farm farm = farmManager.load(projectDirectory.getFileObject(FarmProject.FARM_FILE)); //This FilterNode will be our project node return new FarmNode(farm, farmFolder.getNodeDelegate(), project); } catch (DataObjectNotFoundException ex) { Exceptions.printStackTrace(ex); LOGGER.log(Level.SEVERE,"Farm data object {0} not found: {1}",new Object[]{ex.getFileObject(),ex.getMessage()}); return new AbstractNode(Children.LEAF); } }
@Override protected Node createNodeForKey(Pair<PhpFrameworkProvider, FileObject> key) { FileObject sourcesDirectory = ProjectPropertiesSupport.getSourcesDirectory(project); if (sourcesDirectory == null) { // broken project return null; } try { return new ImportantFileNode(key, sourcesDirectory); } catch (DataObjectNotFoundException ex) { LOGGER.log(Level.WARNING, ex.getMessage(), ex); } return null; }
FileObject fobj = FileUtil.toFileObject(file); try { dobj = DataObject.find(fobj); } catch (DataObjectNotFoundException ex) { ex.printStackTrace(); Node nodeOfDobj = dobj.getNodeDelegate(); EditorCookie ec = nodeOfDobj.getCookie(EditorCookie.class); try { LineCookie lc = (LineCookie)dobj.getCookie(LineCookie.class); Line.Set lineSet = lc.getLineSet(); Line line = lineSet.getCurrent(NbDocument.findLineNumber(docToGo, offset));
public void actionPerformed(ActionEvent e) { try { File fil = MavenSettingsSingleton.getInstance().getM2UserDir(); DataFolder folder = DataFolder.findFolder(FileUtil.createFolder(fil)); // path to template... FileObject temp = Repository.getDefault().getDefaultFileSystem().findResource("Maven2Templates/settings.xml"); //NOI18N DataObject dobj = DataObject.find(temp); DataObject newOne = dobj.createFromTemplate(folder); EditCookie cook = newOne.getCookie(EditCookie.class); if (cook != null) { cook.edit(); } } catch (DataObjectNotFoundException ex) { ex.printStackTrace(); } catch (IOException ex) { ex.printStackTrace(); } }
DataObject dobj = DataObject.find(testFileObjects[0]); final EditorCookie ec = dobj.getLookup().lookup(EditorCookie.class); if (ec != null) { EventQueue.invokeLater(new Runnable() { ex.printStackTrace();
@Override protected PhaseRunner createTask(FileObject fo) { PhaseRunner pr = null; try { final DataObject dobj = DataObject.find(fo); EditorCookie ec = dobj.getCookie(EditorCookie.class); final CsmFile file = CsmUtilities.getCsmFile(dobj, false, false); final Document doc = ec.getDocument(); if (doc != null && file != null) { pr = new PhaseRunnerImpl(dobj, file, doc); } } catch (DataObjectNotFoundException ex) { ex.printStackTrace(); } return pr != null ? pr : lazyRunner(); }
public PositionBounds getChangePosition() { try{ DataObject dataObject = DataObject.find(config); if (!(dataObject instanceof JSFConfigDataObject)) { return null; LOGGER.log(Level.SEVERE, exception.getMessage(), exception); } catch (DataObjectNotFoundException exception) { LOGGER.log(Level.SEVERE, exception.getMessage(), exception);