Package org.openide.loaders

Examples of org.openide.loaders.DataObject


            if (t.getParent().equals( p.getProjectDirectory() )) {
                Children kids = root.getChildren();
                Node[] nodes = kids.getNodes( true );
                Set<Node> folders = new HashSet<Node>();
                for (Node node : nodes) {
                    DataObject dob = node.getLookup().lookup( DataObject.class );
                    if (dob != null) {
                        if (t.equals( dob.getPrimaryFile() )) {
                            return node;
                        }
                    }
                    if (dob instanceof DataFolder) {
                        folders.add( node );
                    }
                }
                // Could be more elegant - for now, handle 2-deep, which is
                // enough for any typical node project
                FileObject par = t.getParent();
                for (Node fld : folders) {
                    DataObject dob = fld.getLookup().lookup( DataObject.class );
                    if (dob != null) {
                        if (par.equals( dob.getPrimaryFile() )) {
                            for (Node nn : fld.getChildren().getNodes( true )) {
                                DataObject d1 = nn.getLookup().lookup( DataObject.class );
                                if (d1 != null && d1.getPrimaryFile().equals( target )) {
                                    return nn;
                                }
                            }
                        }
                    }
View Full Code Here


            }
            File f = new File( pathLocal );
            if (f.exists()) {
                FileObject fo = FileUtil.toFileObject( f );
                try {
                    DataObject dob = DataObject.find( fo );
                    EditorCookie ck = dob.getLookup().lookup( EditorCookie.class );
                    if (ck != null) {
                        LineCookie l = dob.getLookup().lookup( LineCookie.class );
                        if (l != null) {
                            Line goTo = l.getLineSet().getCurrent( Math.max (0, line -1) );
                            if (goTo == null) {
                                goTo =  l.getLineSet().getOriginal(line -1);
                            }
View Full Code Here

                if (node != null) {
                    return node;
                }
            }
            try {
                DataObject dob = DataObject.find( fo );
                Node n = dob.getNodeDelegate();
                synchronized ( this ) {
                    return node = new FilterNode( n );
                }
            } catch ( DataObjectNotFoundException ex ) {
                Logger.getLogger( SourcesChildFactory.class.getName() ).log(
View Full Code Here

    }

    @Override
    protected Node createNodeForKey ( FileObject key ) {
        try {
            DataObject dob = DataObject.find( key );
            return new FilterNode( dob.getNodeDelegate() );
        } catch ( DataObjectNotFoundException ex ) {
            Logger.getLogger( ImportantFilesChildFactory.class.getName() )
                    .log( Level.INFO, "File disappeared before node could be created: {0}", key );
        }
        return null;
View Full Code Here

    public void initialize ( WizardDescriptor wd ) {
        wiz = wd;
        panel = new ProjectWizardPanel( wd );
        if (wiz.getProperty( ProjectWizardKeys.WIZARD_PROP_PROJECT_NAME ) == null) {
            try {
                DataObject ob = DataObject.find( template );
                String nm = ob.getNodeDelegate().getDisplayName();
                //XXX check for already existing and append _1, etc.
                wiz.putProperty( ProjectWizardKeys.WIZARD_PROP_PROJECT_NAME, nm );
            } catch ( DataObjectNotFoundException ex ) {
                Exceptions.printStackTrace( ex );
            }
View Full Code Here

                        Level.FINE, "Error opening project disappeared", ex );
            } catch ( IllegalArgumentException ex ) {
                Exceptions.printStackTrace( ex );
            }
        }
        DataObject dob = DataObject.find( of );
        return new FilterNode( dob.getNodeDelegate() );
    }
View Full Code Here

        public GenericNode ( Key key, ChildFactory<?> factory, NodeJSProject project, InstanceContent content, Mut lkp ) {
            super( Children.create( factory, true ), lkp );
            content.add( this );
            if (key.type() == KeyType.SOURCES) {
                try {
                    DataObject dob = DataObject.find( project.getProjectDirectory() );
                    lkp.add( dob.getNodeDelegate().getLookup() );
                } catch ( DataObjectNotFoundException ex ) {
                    Exceptions.printStackTrace( ex );
                }

            }
View Full Code Here

            setDisplayName( key.toString() );
        }

        @Override
        public Action[] getActions ( boolean ignored ) {
            DataObject dataObject = this.getLookup().lookup( DataObject.class );
            if (dataObject != null) {
                Node n = dataObject.getNodeDelegate();
                return n.getActions( ignored );
            }
            if (key.type() == KeyType.LIBRARIES) {
                NodeJSProject project = getLookup().lookup( NodeJSProject.class );
                assert project != null;
View Full Code Here

            return new Action[0];
        }

        @Override
        public Action getPreferredAction () {
            DataObject dataObject = this.getLookup().lookup( DataObject.class );
            if (dataObject != null) {
                Node n = dataObject.getNodeDelegate();
                return n.getPreferredAction();
            }
            return super.getPreferredAction();
        }
View Full Code Here

    @Override
    protected Node createNodeForKey ( FileObject key ) {
        try {
            if (key.isValid()) {
                DataObject dataObject = DataObject.find( key );
                if (dataObject != null && dataObject.isValid()) {
                    return new FilterNode( dataObject.getNodeDelegate() );
                }
            }
        } catch ( DataObjectNotFoundException ex ) {
            Logger.getLogger( LibraryNodeChildren.class.getName() ).log( Level.INFO,
                    "DataObject disappeared", ex ); //NOI18N
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.