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


Java IStorage.getFullPath方法代碼示例

本文整理匯總了Java中org.eclipse.core.resources.IStorage.getFullPath方法的典型用法代碼示例。如果您正苦於以下問題:Java IStorage.getFullPath方法的具體用法?Java IStorage.getFullPath怎麽用?Java IStorage.getFullPath使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.core.resources.IStorage的用法示例。


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

示例1: getShowInContext

import org.eclipse.core.resources.IStorage; //導入方法依賴的package包/類
/**
 * Provides input so that the Project Explorer can locate the editor's input in its tree.
 */
@Override
public ShowInContext getShowInContext() {
    IEditorInput editorInput = getEditorInput();
    if (editorInput instanceof FileEditorInput) {
        FileEditorInput fei = (FileEditorInput) getEditorInput();
        return new ShowInContext(fei.getFile(), null);
    } else if (editorInput instanceof XtextReadonlyEditorInput) {
        XtextReadonlyEditorInput readOnlyEditorInput = (XtextReadonlyEditorInput) editorInput;
        IStorage storage;
        try {
            storage = readOnlyEditorInput.getStorage();
            return new ShowInContext(storage.getFullPath(), null);
        } catch (CoreException e) {
            // Do nothing
        }
    }
    return new ShowInContext(null, null);
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:22,代碼來源:N4MFEditor.java

示例2: getResourceSet

import org.eclipse.core.resources.IStorage; //導入方法依賴的package包/類
protected ResourceSet getResourceSet(IStorage storage) {
    if (storage instanceof IFile) {
        return resourceSetProvider.get(((IFile) storage).getProject());
    }
    if (workspace != null && storage != null) {
        IPath path = storage.getFullPath();
        if (path != null && !path.isEmpty()) {
            String firstSegment = path.segment(0);
            if (firstSegment != null) {
                IProject project = workspace.getRoot().getProject(firstSegment);
                if (project.isAccessible()) {
                    return resourceSetProvider.get(project);
                }
            }
        }
    }
    return resourceSetProvider.get(null);
}
 
開發者ID:cplutte,項目名稱:bts,代碼行數:19,代碼來源:ResourceForIEditorInputFactory.java

示例3: removeStorage

import org.eclipse.core.resources.IStorage; //導入方法依賴的package包/類
@Override
public boolean removeStorage(ToBeBuilt toBeBuilt, IStorage storage, IProgressMonitor monitor) {
    if (IN4JSArchive.NFAR_FILE_EXTENSION.equals(storage.getFullPath().getFileExtension())
            && storage instanceof IFile) {
        IProject project = ((IFile) storage).getProject();
        String key = project.getName() + "|" + storage.getFullPath().toPortableString();
        Set<URI> cachedURIs = knownEntries.remove(key);
        if (cachedURIs != null) {
            toBeBuilt.getToBeDeleted().addAll(cachedURIs);
        } else {
            // cache not populated, use the index to find the URIs that shall be removed, e.g.
            // can happen after a restart of Eclipse
            Iterable<IResourceDescription> descriptions = builderState.getAllResourceDescriptions();
            String expectedAuthority = "platform:/resource" + storage.getFullPath() + "!";
            Set<URI> toBeDeleted = toBeBuilt.getToBeDeleted();
            for (IResourceDescription description : descriptions) {
                URI knownURI = description.getURI();
                if (knownURI.isArchive()) {
                    String authority = knownURI.authority();
                    if (expectedAuthority.equals(authority)) {
                        toBeDeleted.add(knownURI);
                    }
                }
            }
        }
        return true;
    }
    return false;
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:30,代碼來源:N4JSToBeBuiltComputer.java

示例4: getProject

import org.eclipse.core.resources.IStorage; //導入方法依賴的package包/類
/**
 * @return the project for the file that's being edited (or null if not available)
 */
public IProject getProject() {
    IEditorInput editorInput = this.getEditorInput();
    if (editorInput instanceof IAdaptable) {
        IAdaptable adaptable = editorInput;
        IFile file = adaptable.getAdapter(IFile.class);
        if (file != null) {
            return file.getProject();
        }
        IResource resource = adaptable.getAdapter(IResource.class);
        if (resource != null) {
            return resource.getProject();
        }
        if (editorInput instanceof IStorageEditorInput) {
            IStorageEditorInput iStorageEditorInput = (IStorageEditorInput) editorInput;
            try {
                IStorage storage = iStorageEditorInput.getStorage();
                IPath fullPath = storage.getFullPath();
                if (fullPath != null) {
                    IWorkspace ws = ResourcesPlugin.getWorkspace();
                    for (String s : fullPath.segments()) {
                        IProject p = ws.getRoot().getProject(s);
                        if (p.exists()) {
                            return p;
                        }
                    }
                }
            } catch (Exception e) {
                Log.log(e);
            }

        }
    }
    return null;
}
 
開發者ID:fabioz,項目名稱:Pydev,代碼行數:38,代碼來源:BaseEditor.java

示例5: getURI

import org.eclipse.core.resources.IStorage; //導入方法依賴的package包/類
/**
 * Gets the URI associated with the editor.
 * 
 * @param editor
 * @return
 */
public static URI getURI(IEditorPart editor)
{
    // NOTE: Moved from CommonContentAssistProcessor
    if (editor != null)
    {
        IEditorInput editorInput = editor.getEditorInput();

        if (editorInput instanceof IURIEditorInput)
        {
            IURIEditorInput uriEditorInput = (IURIEditorInput) editorInput;
            return uriEditorInput.getURI();
        }
        if (editorInput instanceof IPathEditorInput)
        {
            IPathEditorInput pathEditorInput = (IPathEditorInput) editorInput;
            return URIUtil.toURI(pathEditorInput.getPath());
        }
        if (editorInput instanceof IFileEditorInput)
        {
            IFileEditorInput fileEditorInput = (IFileEditorInput) editorInput;
            return fileEditorInput.getFile().getLocationURI();
        }
        try
        {
            if (editorInput instanceof IStorageEditorInput)
            {
                IStorageEditorInput storageEditorInput = (IStorageEditorInput) editorInput;
                IStorage storage = storageEditorInput.getStorage();
                if (storage != null)
                {
                    IPath path = storage.getFullPath();
                    if (path != null)
                    {
                        return URIUtil.toURI(path);
                    }
                }
            }
        }
        catch (CoreException e)
        {
            IdeLog.logError(CommonEditorPlugin.getDefault(), e);
        }
        if (editorInput instanceof ILocationProviderExtension)
        {
            ILocationProviderExtension lpe = (ILocationProviderExtension) editorInput;
            return lpe.getURI(null);
        }
        if (editorInput instanceof ILocationProvider)
        {
            ILocationProvider lp = (ILocationProvider) editorInput;
            return URIUtil.toURI(lp.getPath(null));
        }
    }

    return null;
}
 
開發者ID:apicloudcom,項目名稱:APICloud-Studio,代碼行數:63,代碼來源:EditorUtil.java

示例6: getImageForJarEntry

import org.eclipse.core.resources.IStorage; //導入方法依賴的package包/類
private Image getImageForJarEntry(IStorage element) {
    if (element instanceof IJarEntryResource && !((IJarEntryResource) element).isFile()) {
        return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER);
    }

    if (fJarImageMap == null)
        return getDefaultImage();

    if (element == null || element.getName() == null)
        return getDefaultImage();

    // Try to find icon for full name
    String name= element.getName();
    Image image= fJarImageMap.get(name);
    if (image != null)
        return image;
    IFileEditorMapping[] mappings= getEditorRegistry().getFileEditorMappings();
    int i= 0;
    while (i < mappings.length) {
        if (mappings[i].getLabel().equals(name))
            break;
        i++;
    }
    String key= name;
    if (i == mappings.length) {
        // Try to find icon for extension
        IPath path= element.getFullPath();
        if (path == null)
            return getDefaultImage();
        key= path.getFileExtension();
        if (key == null)
            return getDefaultImage();
        image= fJarImageMap.get(key);
        if (image != null)
            return image;
    }

    // Get the image from the editor registry
    ImageDescriptor desc= getEditorRegistry().getImageDescriptor(name);
    image= desc.createImage();

    fJarImageMap.put(key, image);

    return image;
}
 
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:46,代碼來源:StorageLabelProvider.java


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