Package org.openide.loaders

Examples of org.openide.loaders.DataObject


                    isFile = true;
                }
            }

            try {
                DataObject dobj = DataObject.find(fObj);
                FilterNode fn = (isFile ?
                        new FilterNode(dobj.getNodeDelegate(), Children.LEAF) :
                        new FilterNode(dobj.getNodeDelegate(), new SourceGroupsChildren(fObj, grp)));

                if (key instanceof SourceGroup) {
                    fn.setDisplayName(grp.getDisplayName());
                }
View Full Code Here


        return null;
    }
   
    private static FileObject getFileObject(JTextComponent target) {
        BaseDocument doc = (BaseDocument) target.getDocument();
        DataObject dobj = NbEditorUtilities.getDataObject(doc);
        FileObject fobj = (dobj != null) ? NbEditorUtilities.getDataObject(doc).getPrimaryFile() : null;
        return fobj;
    }
View Full Code Here

        new jDependThread().start();
    }

    private void openFileInIDE(FileObject file) {
        try {
            DataObject newDo = DataObject.find(file);
            final Node node = newDo.getNodeDelegate();
            Action a = node.getPreferredAction();
            if (a instanceof ContextAwareAction) {
                a = ((ContextAwareAction) a).createContextAwareInstance(node.getLookup());
            }
            if (a != null) {
View Full Code Here

public final class JalopyFormatter extends CookieAction {
   
    protected void performAction(Node[] activatedNodes) {
        JalopySettings settings = (JalopySettings) SystemOption.findObject(JalopySettings.class, true);
        final File rule = settings.getRuleFile();
        DataObject c = (DataObject) activatedNodes[0].getCookie(DataObject.class);
       
       
        EditorCookie editor = (EditorCookie) c.getCookie(EditorCookie.class);
        final StyledDocument doc = editor.getDocument();
       
        NbDocument.runAtomic(doc,new Runnable(){
            public void run() {
                try {
View Full Code Here

    public ScalaPlatform[] getInstalledPlatforms() {
        List<ScalaPlatform> platforms = new ArrayList<ScalaPlatform>();
        if (storage != null) {
            try {
                for (FileObject platformDefinition : storage.getChildren()) {
                    DataObject dobj = DataObject.find(platformDefinition);
                    InstanceCookie ic = dobj.getCookie(InstanceCookie.class);
                    if (ic == null) {
                        ErrorManager.getDefault().log(ErrorManager.WARNING,"DefaultPlatformStorage: The file: "+    //NOI18N
                            platformDefinition.getNameExt() + " has no InstanceCookie");                           //NOI18N
                        continue;
                    }
View Full Code Here

    private Set<PropertyChangeListener> dataObjectListeners;

    public void annotate (Line.Set set, Lookup lookup) {
        final FileObject fo = lookup.lookup(FileObject.class);
        if (fo != null) {
            final DataObject dobj = lookup.lookup(DataObject.class);
            if (dobj != null) {
                PropertyChangeListener pchl = new PropertyChangeListener() {
                    /** annotate renamed files. */
                    public void propertyChange(PropertyChangeEvent evt) {
                        if (DataObject.PROP_PRIMARY_FILE.equals(evt.getPropertyName())) {
                            FileObject newFO = dobj.getPrimaryFile();
                            annotate(newFO);
                        }
                    }
                };
                dobj.addPropertyChangeListener(WeakListeners.propertyChange(pchl, dobj));
                synchronized (this) {
                    if (dataObjectListeners == null) {
                        dataObjectListeners = new HashSet<PropertyChangeListener>();
                    }
                    // Prevent from GC.
View Full Code Here

        } else {
            throw new IllegalStateException(b.toString());
        }
        boolean isConditional = (condition != null) && condition.trim().length() > 0;
        String annotationType = getAnnotationType(b, isConditional);
        DataObject dataObject;
        try {
            dataObject = DataObject.find(fo);
        } catch (DataObjectNotFoundException donfex) {
            donfex.printStackTrace();
            return ;
        }
        LineCookie lc = dataObject.getCookie(LineCookie.class);
        if (lc == null) return;
        List<DebuggerBreakpointAnnotation> annotations = new ArrayList<DebuggerBreakpointAnnotation>();
        for (int l : lines) {
            try {
                Line line = lc.getLineSet().getCurrent(l - 1);
View Full Code Here

            FileObject storage = FileUtil.getConfigFile(STORAGE);
            if (storage != null) {
                java.util.Map<String,PlatformCategoriesDescriptor> categories = new HashMap<String,PlatformCategoriesDescriptor>();
                for (FileObject child : storage.getChildren()) {
                    try {
                        DataObject dobj = DataObject.find(child);
                        Node node = dobj.getNodeDelegate();
                        ScalaPlatform platform = node.getLookup().lookup(ScalaPlatform.class);
                        if (platform != null) {
                            String platformType = platform.getSpecification().getName();
                            if (platformType != null) {
                                platformType = platformType.toUpperCase(Locale.ENGLISH);
View Full Code Here

        return true;
    }

    /** Add the line offset into the jump history */
    private void addPositionToJumpList(String url, Line l, int column) {
        DataObject dataObject = getDataObject(url);
        if (dataObject != null) {
            EditorCookie ec = dataObject.getLookup().lookup(EditorCookie.class);
            if (ec != null) {
                try {
                    StyledDocument doc = ec.openDocument();
                    JEditorPane[] eps = ec.getOpenedPanes();
                    if (eps != null && eps.length > 0) {
View Full Code Here

    @Override
    public int getFieldLineNumber(
            String url,
            final String className,
            final String fieldName) {
        final DataObject dataObject = getDataObject(url);
        if (dataObject == null) {
            return -1;
        }
        return getFieldLineNumber(dataObject.getPrimaryFile(), className, fieldName);
    }
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.