Package org.openide.loaders

Examples of org.openide.loaders.DataObject


            TopManager.getDefault().notify(d);
            return;
        }

        FileSystem fs = Repository.getDefault().getDefaultFileSystem();
        DataObject result = null;
        try {
            DataObject dObj = DataObject.find(fs.findResource(sourceFile));
            result = dObj.createFromTemplate(parent);
        }
        catch (IOException ioe) {
            ErrorManager.getDefault().notify(ioe);
        }
View Full Code Here


        FileObject fileObj = node.getLookup().lookup(FileObject.class);
        if (fileObj != null && fileObj.isValid()) {
            return fileObj;
        }
        DataObject dataObj = node.getCookie(DataObject.class);
        if (dataObj == null) {
            return null;
        }
        fileObj = dataObj.getPrimaryFile();
        if (fileObj != null && fileObj.isValid()) {
            return fileObj;
        }
        return null;
    }
View Full Code Here

        CodeSnifferFileListener l = new CodeSnifferFileListener();
        l.setLogResult(rs);
        fo.addFileChangeListener(l);
       
        try {
            DataObject d = DataObject.find(fo);
            LineCookie cookie = d.getCookie(LineCookie.class);
           
            Line.Set lineSet = null;
            Line line = null;
            for (int i = 0; i < rs.getCsErrors().size(); i++) {
                lineSet = cookie.getLineSet();
View Full Code Here

                    if (autoCompleteFile.exists()) {
                        autoCompleteFile.delete();
                    }

                    DataFolder autoCompleteDirectoryDataFolder = DataFolder.findFolder(autoCompleteDirectory);
                    DataObject autoCompleteTemplateDataObject = DataObject.find(autoCompleteTemplateFile);
                    autoCompleteTemplateDataObject.createFromTemplate(autoCompleteDirectoryDataFolder, AUTO_COMPLETE_FILE_NAME, parameters);
                    PhpProjectSupport.setIncludePath(project, FileUtil.getRelativePath(projectDirectory, autoCompleteDirectory));
                } catch (IOException ex) {
                    Exceptions.printStackTrace(ex);
                }
            }
View Full Code Here

  if (null == activeTC) {
      return null;
  }

  DataObject dataObject = activeTC.getLookup().lookup(DataObject.class);
  Project project = activeTC.getLookup().lookup(Project.class);
  Node node = activeTC.getLookup().lookup(Node.class);
  FileObject fileObject = activeTC.getLookup().lookup(FileObject.class);
  //                showInStatusBar(project);
View Full Code Here

        Collection<JavaPackage> packages = ProjectUtils.getSourcePackages(p, true);
        JavaPackageComboBoxModel model = new JavaPackageComboBoxModel();
        model.addAll(packages);
        packageCombo.setModel(model);
        if (model.getSize() > 0) {
            DataObject data = PackageUtils.getSelectedPackage();
            if (data != null) {
                try {
                    final JavaPackage selected = new JavaPackage(ClassPathUtils.getSourceClassPath(p), data.getPrimaryFile());
                    packageCombo.setSelectedItem(selected);
                } catch (Exception ex) {
                    packageCombo.setSelectedIndex(0);
                }
            } else {
View Full Code Here

    public static Project getSelectedProject(final Lookup context) {
        Lookup.Result<Project> projectLookup = context.lookupResult(Project.class);
        Project p = (projectLookup.allInstances().isEmpty()) ? null : projectLookup.allInstances().iterator().next();
        if (p == null) {
            DataObject packageNode = PackageUtils.getSelectedPackage(context);
            if (packageNode != null) {
                p = FileOwnerQuery.getOwner(packageNode.getPrimaryFile());
            }
        }
        return p;
    }
View Full Code Here

            String messageTitle = org.openide.util.NbBundle.getMessage(SonarIssuesTopComponent.class, "SonarIssuesTopComponent.unexistentFile.title");
            String message = MessageFormat.format(org.openide.util.NbBundle.getMessage(SonarIssuesTopComponent.class, "SonarIssuesTopComponent.unexistentFile.text"), file.getPath());
            JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), message, messageTitle, JOptionPane.WARNING_MESSAGE);
            return;
        }
        DataObject dobj = null;
        try {
            dobj = DataObject.find(fobj);
        } catch (DataObjectNotFoundException ex) {
            Exceptions.printStackTrace(ex);
        }
        if (dobj != null) {
            EditorCookie ec = (EditorCookie) dobj.getLookup().lookup(EditorCookie.class);
            if (ec != null) {
                ec.open();
                Line.Set lineSet = ec.getLineSet();
                int index = lineNumber-1;
                assert !lineSet.getLines().isEmpty();
View Full Code Here

        File selFile = returnLocalFile();
        if (selFile == null) {
            return;
        }
        FileObject file;
        DataObject dob;
        try {
            FileWriter fw = new FileWriter(selFile);
            OracleConnection conn = ou.getConn();
            this.LoadObjectSource(conn);
            if (conn != null) {
                try {
                    conn.close();
                } catch (SQLException ex) {
                    Exceptions.printStackTrace(ex);
                }
            }
            fw.write(this.ObjectSource);
            fw.close();
            //file = Repository.getDefault().getDefaultFileSystem().findResource(selFile.getCanonicalPath());
            file = FileUtil.toFileObject(selFile);
            dob = DataObject.find(file);
            EditCookie cookie = dob.getCookie(EditCookie.class);
            if (cookie != null) {
                cookie.edit();
            }
            setLocalFile(selFile.getCanonicalPath());
        } catch (IOException ex) {
View Full Code Here

                ou.OutputMsg(Utils.getBundle().getString("LBL_Done"), null, false);
                File f = new File(getLocalFile());
                if (f.exists()) {
                    try {
                        FileObject file = FileUtil.toFileObject(f);
                        DataObject dob = DataObject.find(file);
                        CloseCookie cookie = dob.getCookie(CloseCookie.class);
                        if (cookie != null) {
                            cookie.close();
                        }
                    } catch (IOException e) {
                        //Exceptions.printStackTrace(e);
View Full Code Here

TOP

Related Classes of org.openide.loaders.DataObject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.