Package org.eclipse.core.resources

Examples of org.eclipse.core.resources.IResource


        wc = configType.newInstance(null, manager.generateUniqueLaunchConfigurationNameFrom(targetPath.lastSegment()));
        wc.setAttribute(LaunchConstants.ATTR_LAUNCH_TARGET, targetPath.toString());
        wc.setAttribute(LaunchConstants.ATTR_CLEAN, LaunchConstants.DEFAULT_CLEAN);
        wc.setAttribute(LaunchConstants.ATTR_DYNAMIC_BUNDLES, LaunchConstants.DEFAULT_DYNAMIC_BUNDLES);

        IResource targetResource = ResourcesPlugin.getWorkspace().getRoot().findMember(targetPath);
        if (targetResource != null && targetResource.exists()) {
            wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, LaunchUtils.getLaunchProjectName(targetResource));
        }

        return wc;
    }
View Full Code Here


        if (selection instanceof IStructuredSelection) {
            Object element = ((IStructuredSelection) selection).getFirstElement();
            if (element instanceof IResource)
                return ((IResource) element).getProject();
            else if (element instanceof IAdaptable) {
                IResource resource = (IResource) ((IAdaptable) element).getAdapter(IResource.class);
                if (resource != null)
                    return resource.getProject();
            }
        }
        return null;
    }
View Full Code Here

        }
        return null;
    }

    protected static IProject getProject(IEditorPart editorPart) {
        IResource resource = ResourceUtil.getResource(editorPart);
        return resource != null ? resource.getProject() : null;
    }
View Full Code Here

        loadProblems();
    }

    void loadProblems() {
        IResource resource = ResourceUtil.getResource(getEditorInput());
        problemSeverity = 0;
        messageSeverityMap.clear();

        if (resource != null) {
            try {
                IMarker[] markers;

                markers = resource.findMarkers(BndtoolsConstants.MARKER_BND_CLASSPATH_PROBLEM, true, 0);
                loadMarkers(markers);
                markers = resource.findMarkers(BndtoolsConstants.MARKER_BND_PROBLEM, true, 0);
                loadMarkers(markers);
            } catch (CoreException e) {
                logger.logError("Error retrieving problem markers", e);
            }
        }
View Full Code Here

    public Image getTitleImage() {
        return pageImage;
    }

    public void resourceChanged(IResourceChangeEvent event) {
        IResource myResource = ResourceUtil.getResource(getEditorInput());

        IResourceDelta delta = event.getDelta();
        if (delta == null)
            return;
        IPath fullPath = myResource.getFullPath();
        delta = delta.findMember(fullPath);
        if (delta == null)
            return;

        if ((delta.getKind() & IResourceDelta.CHANGED) != 0 && (delta.getFlags() & IResourceDelta.MARKERS) != 0) {
View Full Code Here

        setSourcePage(sourcePage);

        setPartNameForInput(input);

        IResource resource = ResourceUtil.getResource(input);
        String resourceName;
        if (resource != null) {
            resource.getWorkspace().addResourceChangeListener(this);
            resourceName = resource.getName();
        } else {
            IStorage storage = (IStorage) input.getAdapter(IStorage.class);
            if (storage != null) {
                resourceName = storage.getName();
            } else {
                resourceName = input.getName();
            }
        }

        final IDocumentProvider docProvider = sourcePage.getDocumentProvider();
        IDocument document = docProvider.getDocument(input);
        try {
            model.loadFrom(new IDocumentWrapper(document));
            model.setBndResourceName(resourceName);

            if (resource != null) {
                model.setBndResource(resource.getLocation().toFile());
            }
            // model.addPropertyChangeListener(modelListener);
        } catch (IOException e) {
            throw new PartInitException("Error reading editor input.", e);
        }
View Full Code Here

        String name = input.getName();
        if (isMainWorkspaceConfig(path, projectName) || isExtWorkspaceConfig(path, projectName)) {
            name = path;
        } else if (Project.BNDFILE.equals(name)) {
            IResource resource = ResourceUtil.getResource(input);
            if (resource != null)
                name = projectName;
        } else if (name.endsWith(".bnd")) {
            IResource resource = ResourceUtil.getResource(input);
            if (resource != null)
                name = projectName + "." + name.substring(0, name.length() - ".bnd".length());
        } else if (name.endsWith(".bndrun")) {
            name = name.substring(0, name.length() - ".bndrun".length());
        }
View Full Code Here

        setPartName(name);
    }

    @Override
    public void dispose() {
        IResource resource = ResourceUtil.getResource(getEditorInput());

        super.dispose();

        if (resource != null) {
            resource.getWorkspace().removeResourceChangeListener(this);
        }

        buildFileImg.dispose();
    }
View Full Code Here

    public BndEditModel getEditModel() {
        return this.model;
    }

    public void resourceChanged(IResourceChangeEvent event) {
        IResource myResource = ResourceUtil.getResource(getEditorInput());

        IResourceDelta delta = event.getDelta();
        if (delta == null)
            return;
        IPath fullPath = myResource.getFullPath();
        delta = delta.findMember(fullPath);
        if (delta == null)
            return;

        // Delegate to any interested pages
View Full Code Here

                modelSourcePathsResources = new HashSet<IResource>();
                for (File modelSourcePath : modelSourcePaths) {
                    if (projectBaseFile.equals(modelSourcePath.getAbsoluteFile())) {
                        continue;
                    }
                    IResource modelSourcePathResource = FileUtils.toProjectResource(project, modelSourcePath);
                    if (modelSourcePathResource != null) {
                        modelSourcePathsResources.add(modelSourcePathResource);
                    }
                }
            }
View Full Code Here

TOP

Related Classes of org.eclipse.core.resources.IResource

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.