當前位置: 首頁>>代碼示例>>Java>>正文


Java DataObjectNotFoundException類代碼示例

本文整理匯總了Java中org.openide.loaders.DataObjectNotFoundException的典型用法代碼示例。如果您正苦於以下問題:Java DataObjectNotFoundException類的具體用法?Java DataObjectNotFoundException怎麽用?Java DataObjectNotFoundException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


DataObjectNotFoundException類屬於org.openide.loaders包,在下文中一共展示了DataObjectNotFoundException類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: findIconForPath

import org.openide.loaders.DataObjectNotFoundException; //導入依賴的package包/類
private static Icon findIconForPath(String path) {
    FileObject fo = RecentFiles.convertPath2File(path);
    final Icon i;
    if (fo == null) {
        i = null;
    } else {
        DataObject dObj;
        try {
            dObj = DataObject.find(fo);
        } catch (DataObjectNotFoundException e) {
            dObj = null;
        }
        i = dObj == null
                ? null
                : new ImageIcon(dObj.getNodeDelegate().getIcon(
                BeanInfo.ICON_COLOR_16x16));
    }
    return i;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:20,代碼來源:RecentFiles.java

示例2: get

import org.openide.loaders.DataObjectNotFoundException; //導入依賴的package包/類
@Override
public EditorLineHandler get(FileObject fo, int lineNumber) {
    try {
        DataObject dobj = DataObject.find(fo);
        LineCookie lineCookie = dobj.getLookup().lookup(LineCookie.class);
        if (lineCookie == null) {
            return null;
        }
        try {
            Line line = lineCookie.getLineSet().getCurrent(lineNumber - 1);
            return new LineDelegate(line);
        } catch (IndexOutOfBoundsException ioobex) {
            // The line is gone.
            return null;
        }
    } catch (DataObjectNotFoundException ex) {
        return null;
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:20,代碼來源:EditorLineHandlerFactoryImpl.java

示例3: getDataObject

import org.openide.loaders.DataObjectNotFoundException; //導入依賴的package包/類
private static DataObject getDataObject (String url) {
    FileObject file;
    try {
        file = URLMapper.findFileObject (new URL (url));
    } catch (MalformedURLException e) {
        return null;
    }

    if (file == null) {
        return null;
    }
    try {
        return DataObject.find (file);
    } catch (DataObjectNotFoundException ex) {
        return null;
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:18,代碼來源:LineTranslations.java

示例4: isPrimaryFile

import org.openide.loaders.DataObjectNotFoundException; //導入依賴的package包/類
/**
 * Test that a file is the primary file of its DataObject.
 */
private boolean isPrimaryFile(FileObject file) {
    try {
        DataObject dob = DataObject.find(file);
        if (dob.getPrimaryFile().equals(file)) {
            return true;
        } else {
            return false;
        }
    } catch (DataObjectNotFoundException ex) {
        String msg = "DataObject not found for file:" + file;       //NOI18N
        Logger logger = Logger.getLogger(VisibilityFilter.class.getName());
        logger.log(Level.INFO, msg, ex);
        return true;
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:19,代碼來源:VisibilityFilter.java

示例5: getLastResource2

import org.openide.loaders.DataObjectNotFoundException; //導入依賴的package包/類
/** Getter for last resource property. */
public DataObject getLastResource2(DataObject srcDataObject) {
    String path = getPreferences().get(PROP_LAST_RESOURCE2,null);
    if(path == null) {
        return null;
    }
    FileObject f = (srcDataObject != null) ? findFileObject(srcDataObject, path) : findFileObject(path);
    if ((f != null) && !f.isFolder() && f.isValid()) {
        try {
            return DataObject.find(f);
        } catch (DataObjectNotFoundException e) {
            /* The file was probably deleted or moved. */
            getPreferences().remove(PROP_LAST_RESOURCE2);
        }
    }
    return null;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:18,代碼來源:I18nOptions.java

示例6: initialize

import org.openide.loaders.DataObjectNotFoundException; //導入依賴的package包/類
@Override
public boolean initialize(Lookup context, AtomicBoolean cancel) {
    FileObject file = context.lookup(FileObject.class);
    if (file == null || file.isFolder()) {
        return false;
    }

    DataObject currentFileDo = null;
    try {
        currentFileDo = DataObject.find(file);
    } catch (DataObjectNotFoundException ex) {
    } // Not important, only for Icon.
    icon = currentFileDo != null ? new ImageIcon(currentFileDo.getNodeDelegate().getIcon(BeanInfo.ICON_COLOR_16x16)) : null;
    detail = file.getNameExt();
    scope = Scope.create(null, null, Arrays.asList(file));

    return true;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:19,代碼來源:CurrentFileScopeProvider.java

示例7: getNodes

import org.openide.loaders.DataObjectNotFoundException; //導入依賴的package包/類
private final Vector getNodes() {
    Vector<Node> result = new Vector<Node>(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) {
            Exceptions.printStackTrace(ex);
        }
        if (d instanceof DataFolder) {
            for (DataObject o : ((DataFolder) d).getChildren()) {
                q.addLast(o.getPrimaryFile());
            }
        } else if(d != null) {
            result.add(d.getNodeDelegate());
        }
    }
    return result;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:25,代碼來源:CopyClassesUI.java

示例8: createTestModelSource

import org.openide.loaders.DataObjectNotFoundException; //導入依賴的package包/類
public ModelSource createTestModelSource(FileObject fo, boolean editable) throws CatalogModelException{
    final DataObject dobj;
    final CatalogModel catalogModel = createCatalogModel(fo);
    try {
        dobj = DataObject.find(fo);
    } catch (DataObjectNotFoundException ex) {
        throw new CatalogModelException(ex);
    }
    Lookup lookup = Lookups.proxy(new Lookup.Provider() {
        public Lookup getLookup() {
                    return Lookups.fixed(new Object[] {
                        dobj.getPrimaryFile(),
                        getDocument(dobj.getPrimaryFile()),
                        dobj,
                        catalogModel
                    });
        }
    } );
    return new ModelSource(lookup, editable);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:21,代碼來源:TestCatalogModel.java

示例9: fileChanged

import org.openide.loaders.DataObjectNotFoundException; //導入依賴的package包/類
@Override
public void fileChanged(final FileEvent fe) {
    if (fe.getTime() > lastSaveTime) {
        lastSaveTime = System.currentTimeMillis();

        // Refresh image viewer
        SwingUtilities.invokeLater(new Runnable() {

            public void run() {
                try {
                    currentDataObject = DataObject.find(fe.getFile());
                    setNewContent(currentDataObject);
                } catch (DataObjectNotFoundException ex) {
                    Logger.getLogger(ImageNavigatorPanel.class.getName()).info(NbBundle.getMessage(ImageNavigatorPanel.class, "ERR_DataObject"));
                }
            }
        });
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:20,代碼來源:ImageNavigatorPanel.java

示例10: createNodes

import org.openide.loaders.DataObjectNotFoundException; //導入依賴的package包/類
protected @Override Node[] createNodes(String key) {
    if (key.equals(KEY_LAYER)) {
        Node n = NodeFactoryUtils.createLayersNode(project);
        return n != null ? new Node[] {n} : null;
    } else {
        String locEval = project.evaluator().evaluate(key);
        FileObject file = project.getHelper().resolveFileObject(locEval);
        try {
            if (file == null) {
                return null;
            } else {
                Node orig = DataObject.find(file).getNodeDelegate();
                return new Node[] {NodeFactoryUtils.createSpecialFileNode(orig, FILES.get(key))};
            }
        } catch (DataObjectNotFoundException e) {
            throw new AssertionError(e);
        }
    } 
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:20,代碼來源:ImportantFilesNodeFactory.java

示例11: findBundleStructure

import org.openide.loaders.DataObjectNotFoundException; //導入依賴的package包/類
/**
 * Find existing BundleStructure instance.
 * @return BundleStructure from first DataObject with the same base name or null
 */
protected synchronized BundleStructure findBundleStructure() {
    PropertiesDataObject dataObject = null;
    BundleStructure structure;
    try {
        dataObject = Util.findPrimaryDataObject(this);
    } catch (DataObjectNotFoundException doe) {
        Exceptions.printStackTrace(doe);
    }
    if(this == dataObject) {
        structure = new MultiBundleStructure(this);
        return structure;
    } else {
        return dataObject.getBundleStructure();
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:20,代碼來源:PropertiesDataObject.java

示例12: node

import org.openide.loaders.DataObjectNotFoundException; //導入依賴的package包/類
public Node node(final SourceGroup key) {
    try {
        Node nodeDelegate = DataObject.find(key.getRootFolder()).getNodeDelegate();
        return new FilterNode(nodeDelegate,
                null, new ProxyLookup(nodeDelegate.getLookup(), Lookups.singleton(new PathFinder(key)))) {
            @Override
            public String getName() {
                return key.getName();
            }
            @Override
            public String getDisplayName() {
                return key.getDisplayName();
            }
        };
    } catch (DataObjectNotFoundException ex) {
        throw new AssertionError(ex);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:19,代碼來源:TestDataDirsNodeFactory.java

示例13: findBeanInfo

import org.openide.loaders.DataObjectNotFoundException; //導入依賴的package包/類
/** Finds the bean info for classElement asspciated with this
    object */
void findBeanInfo(FileObject javafile) throws GenerateBeanException {

    javaEditor = null;
    try {
        this.javaDataObject = DataObject.find(javafile);
        FileObject parent = javafile.getParent();
        FileObject bifile = parent.getFileObject(javafile.getName() + BEANINFO_NAME_EXT, "java"); // NOI18N
        if (bifile != null) {
            biDataObject = DataObject.find(bifile);
            javaEditor = biDataObject.getLookup().lookup(BIEditorSupport.class);
        }
    } catch (DataObjectNotFoundException ex) {
        throw new GenerateBeanException();
        // Do nothing if no data object is found
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:19,代碼來源:BeanInfoSource.java

示例14: loadTestTemplate

import org.openide.loaders.DataObjectNotFoundException; //導入依賴的package包/類
/**
 * Loads a test template.
 * If the template loading fails, displays an error message.
 *
 * @param  templateID  bundle key identifying the template type
 * @return  loaded template, or <code>null</code> if the template
 *          could not be loaded
 */
private static DataObject loadTestTemplate(String templateID) {
    // get the Test class template
    String path = templateID;
    try {
        FileObject fo = FileUtil.getConfigFile(path);
        if (fo == null) {
            noTemplateMessage(path);
            return null;
        }
        return DataObject.find(fo);
    }
    catch (DataObjectNotFoundException e) {
        noTemplateMessage(path);
        return null;
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:25,代碼來源:DefaultPlugin.java

示例15: testMoveAction

import org.openide.loaders.DataObjectNotFoundException; //導入依賴的package包/類
public void testMoveAction() throws InterruptedException, InvocationTargetException, DataObjectNotFoundException, IOException {
    DataObject testdo = DataObject.find(f);
    final Node node = testdo.getNodeDelegate();

    InstanceContent ic = new InstanceContent();
    Lookup lookup = new AbstractLookup(ic);
    ic.add(node);
    final Action move = RefactoringActionsFactory.moveAction().createContextAwareInstance(lookup);
    SwingUtilities.invokeAndWait(new Runnable() {
        @Override
        public void run() {
            if (move.isEnabled()) {
                move.actionPerformed(RefactoringActionsFactory.DEFAULT_EVENT);
                if (!((MoveRefactoring) DD.rui.getRefactoring()).getRefactoringSource().lookup(FileObject.class).equals(f))
                    fail("MoveClass was opened with wrong data");
            } else {
                fail("Action is not enabled.");
            }
        }
    });
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:22,代碼來源:ActionInvocationTest.java


注:本文中的org.openide.loaders.DataObjectNotFoundException類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。