Java Code Examples for org.openide.loaders.DataObjectNotFoundException#printStackTrace()

The following examples show how to use org.openide.loaders.DataObjectNotFoundException#printStackTrace() . 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: JAXBWizardOpenXSDIntoEditorAction.java    From netbeans with Apache License 2.0 6 votes vote down vote up
protected void performAction(Node[] nodes) {
    Node node = nodes[ 0 ];
    
    FileObject fo = node.getLookup().lookup(FileObject.class );
    try {
    if ( fo != null ) {
        DataObject dataObject = DataObject.find( fo );
        if ( dataObject != null ) {
            EditCookie ec = dataObject.getCookie(EditCookie.class );
            if ( ec != null ) {
                ec.edit();
            }
        }
    }
    } catch ( DataObjectNotFoundException donfe ) {
        donfe.printStackTrace();
    }
}
 
Example 2
Source File: MoveClassesUI.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private final Vector getNodes() {
    Vector<Node> result = new Vector(javaObjects.size());
    LinkedList<FileObject> q = new LinkedList<FileObject>(javaObjects);
    while (!q.isEmpty()) {
        FileObject f = q.removeFirst();
        if (!VisibilityQuery.getDefault().isVisible(f)) {
            continue;
        }
        DataObject d = null;
        try {
            d = DataObject.find(f);
        } catch (DataObjectNotFoundException ex) {
            ex.printStackTrace();
        }
        if (d instanceof DataFolder) {
            for (DataObject o:((DataFolder) d).getChildren()) {
                q.addLast(o.getPrimaryFile());
            }
        } else {
            result.add(d.getNodeDelegate());
        }
    }
    return result;
}
 
Example 3
Source File: AbstractRefactoringElement.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public PositionBounds getPosition() {
    try {
        DataObject dobj = DataObject.find(getParentFile());
        if (dobj != null) {
            EditorCookie.Observable obs = (EditorCookie.Observable)dobj.getCookie(EditorCookie.Observable.class);
            if (obs != null && obs instanceof CloneableEditorSupport) {
                CloneableEditorSupport supp = (CloneableEditorSupport)obs;

                if (loc == null) {
                    loc = location();
                }
            PositionBounds bounds = new PositionBounds(
                    supp.createPositionRef(loc[0], Position.Bias.Forward),
                    supp.createPositionRef(Math.max(loc[0], loc[1]), Position.Bias.Forward)
                    );
            
            return bounds;
        }
        }
    } catch (DataObjectNotFoundException ex) {
        ex.printStackTrace();
    }
    return null;
}
 
Example 4
Source File: ProblemReporterImpl.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public void actionPerformed(ActionEvent e) {
    if (fo != null) {
        try {
            DataObject dobj = DataObject.find(fo);
            EditCookie edit = dobj.getLookup().lookup(EditCookie.class);
            edit.edit();
        } catch (DataObjectNotFoundException ex) {
            ex.printStackTrace();
        }
    }
}
 
Example 5
Source File: MiscEditorUtil.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public static void openFileObject(FileObject fileObject) {
    if (fileObject == null) {
        return;
    }
    
    try {
        DataObject dataObject = DataObject.find(fileObject);
        EditorCookie cookie = dataObject.getCookie(EditorCookie.class);
        cookie.open();
    } catch (DataObjectNotFoundException e) {
        e.printStackTrace();
    }
}
 
Example 6
Source File: MiscEditorUtil.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public static LineCookie getLineCookie(final FileObject fo) {
    LineCookie result = null;
    try {
        DataObject dataObject = DataObject.find(fo);
        if (dataObject != null) {
            result = dataObject.getCookie(LineCookie.class);
        }
    } catch (DataObjectNotFoundException e) {
        e.printStackTrace();
    }
    return result;
}
 
Example 7
Source File: JSTestDriverSupport.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private Line getLine() {
    LineCookie result = null;
    try {
        DataObject dataObject = DataObject.find(fo);
        if (dataObject != null) {
            result = dataObject.getCookie(LineCookie.class);
        }
    } catch (DataObjectNotFoundException e) {
        e.printStackTrace();
    }
    if (result != null) {
        return result.getLineSet().getCurrent(line-1);
    }
    return null;
}
 
Example 8
Source File: JaxWsInvokeOperation.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public void invokeOperation(Lookup sourceNodeLookup, JTextComponent targetComponent) {
    try {
        DataObject dObj = DataObject.find(targetSource);
        JaxWsCodeGenerator.insertMethodCall(getTargetSourceType(dObj),
                dObj,
                sourceNodeLookup);
    } catch (DataObjectNotFoundException ex) {
        ex.printStackTrace();
    }
}
 
Example 9
Source File: JSUtils.java    From netbeans with Apache License 2.0 5 votes vote down vote up
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;
}