Examples of IWorkspace


Examples of org.eclipse.core.resources.IWorkspace

    }

    public static IResource toWorkspaceResource(File file) {
        IPath path = new Path(file.toString());

        final IWorkspace workspace = ResourcesPlugin.getWorkspace();
        final IWorkspaceRoot workspaceRoot = workspace.getRoot();
        IPath workspacePath = workspaceRoot.getLocation();

        if (workspacePath.isPrefixOf(path)) {
            final IPath relativePath = path.removeFirstSegments(workspacePath.segmentCount());
            IResource resource;
View Full Code Here

Examples of org.eclipse.core.resources.IWorkspace

        } catch (final Exception e) {
            return null;
        }

        IPath bundlePath = path;
        IWorkspace workspace = ResourcesPlugin.getWorkspace();
        IWorkspaceRoot root = workspace.getRoot();
        IResource resource = root.findMember(path);
        if (resource != null) {
            bundlePath = resource.getLocation();
        }
View Full Code Here

Examples of org.eclipse.core.resources.IWorkspace

        final String suggestedVersion = marker.getAttribute(PROP_SUGGESTED_VERSION, null);
        if (suggestedVersion != null) {
            result.add(new IMarkerResolution() {
                public void run(IMarker marker) {
                    final IFile file = (IFile) marker.getResource();
                    final IWorkspace workspace = file.getWorkspace();
                    try {
                        workspace.run(new IWorkspaceRunnable() {
                            public void run(IProgressMonitor monitor) throws CoreException {
                                String input = "version " + suggestedVersion;
                                ByteArrayInputStream stream = new ByteArrayInputStream(input.getBytes());
                                file.setContents(stream, false, true, monitor);
                            }
View Full Code Here

Examples of org.eclipse.core.resources.IWorkspace

        if (!PROTOCOL.equals(protocol))
            throw new MalformedURLException("Unsupported protocol");

        IPath path = new Path(url.getPath());

        IWorkspace workspace = workspaceTracker.getService();
        if (workspace == null)
            throw new IOException("Workspace is not available");

        IPath workspaceLocation = workspace.getRoot().getLocation();
        if (workspaceLocation == null)
            throw new IOException("Cannot determine workspace location.");

        IPath location = workspaceLocation.append(path);
View Full Code Here

Examples of org.eclipse.core.resources.IWorkspace

    if (!(part instanceof IEditorPart)) return new IFile[] {};
    IEditorInput input = ((IEditorPart) part).getEditorInput();
    if (!(input instanceof IPathEditorInput)) return new IFile[] {};
    IPathEditorInput pathInput = (IPathEditorInput) input;
//    System.out.println(pathInput.getPath());
    IWorkspace workspace = ResourcesPlugin.getWorkspace();
    return workspace.getRoot().findFilesForLocation(pathInput.getPath());
  }
View Full Code Here

Examples of org.eclipse.core.resources.IWorkspace

    private final class Validator implements Observer {

        @Override
        public void update(Observable o, Object arg) {

            final IWorkspace workspace = JavaPlugin.getWorkspace();

            final String name = null;// fNameGroup.getName();

            // check whether the project name field is empty
            if ((name == null) || (name.length() == 0)) {
                setErrorMessage(null);
                setMessage("Enter a project name.");
                setPageComplete(false);
                return;
            }

            // check whether the project name is valid
            @SuppressWarnings("unused")
            final IStatus nameStatus = workspace.validateName(name, IResource.PROJECT);
            if (!nameStatus.isOK()) {
                setErrorMessage(nameStatus.getMessage());
                setPageComplete(false);
                return;
            }

            // check whether project already exists
            final IProject handle = workspace.getRoot().getProject(name);
            if (handle.exists()) {
                setErrorMessage("A project with this name already exists.");
                setPageComplete(false);
                return;
            }
View Full Code Here

Examples of org.eclipse.core.resources.IWorkspace

        try {
            getContainer().run(false, true, new IRunnableWithProgress() {
                @Override
                public void run(IProgressMonitor monitor) throws InvocationTargetException,
                InterruptedException {
                    final IWorkspace workspace = ResourcesPlugin.getWorkspace();
                    boolean autobuild = workspace.isAutoBuilding();
                    try {
                        if (autobuild) {
                            // Disable auto build during project setup.
                            final IWorkspaceDescription wsDescription = workspace.getDescription();
                            autobuild = wsDescription.isAutoBuilding();
                            wsDescription.setAutoBuilding(false);
                            workspace.setDescription(wsDescription);
                        }
                        final List<AndroidProject> projects = page2.getSelectedProjects();
                        monitor.beginTask("Creating projects", projects.size());
                        for (final AndroidProject androidProject : projects) {
                            monitor.subTask(androidProject.getName());
                            androidProject.create(monitor);
                            monitor.worked(1);
                        }
                        monitor.done();
                        if (autobuild) {
                            // re-enable auto build
                            final IWorkspaceDescription wsDescription = workspace.getDescription();
                            wsDescription.setAutoBuilding(true);
                            workspace.setDescription(wsDescription);
                        }
                    } catch (final CoreException e) {
                        throw new InvocationTargetException(e);
                    }
                }
View Full Code Here

Examples of org.eclipse.core.resources.IWorkspace

            SigilProjectWizardFirstPage.class, "/icons/logo64x64.gif"));
    }

    public boolean isInWorkspace()
    {
        IWorkspace workspace = ResourcesPlugin.getWorkspace();

        IPath defaultDefaultLocation = workspace.getRoot().getLocation();

        return defaultDefaultLocation.isPrefixOf(getLocationPath());
    }
View Full Code Here

Examples of org.eclipse.core.resources.IWorkspace

     * @see org.eclipse.jface.wizard.Wizard#performFinish()
     */
    @Override
    public boolean performFinish()
    {
        IWorkspace workspace = ResourcesPlugin.getWorkspace();

        IWorkspaceRunnable op = new IWorkspaceRunnable()
        {
            public void run(IProgressMonitor monitor) throws CoreException
            {
                try
                {
                    finishPage(monitor);
                }
                catch (InterruptedException e)
                {
                    throw new OperationCanceledException(e.getMessage());
                }
            }
        };

        try
        {
            workspace.run(op, Job.getJobManager().createProgressGroup());
        }
        catch (CoreException e)
        {
            SigilCore.error("Failed to complete project wizard", e);
            return false;
View Full Code Here

Examples of org.eclipse.core.resources.IWorkspace

    private boolean changeToNewProject()
    {
        boolean updated = false;
        if (!created)
        {
            IWorkspace workspace = ResourcesPlugin.getWorkspace();

            IWorkspaceRunnable op = new IWorkspaceRunnable()
            {
                public void run(IProgressMonitor monitor) throws CoreException
                {
                    try
                    {
                        updateProject(monitor);
                    }
                    catch (InterruptedException e)
                    {
                        throw new OperationCanceledException(e.getMessage());
                    }
                }
            };

            try
            {
                workspace.run(op, workspace.getRoot(), IWorkspace.AVOID_UPDATE,
                    Job.getJobManager().createProgressGroup());
                setErrorMessage(null);
                setPageComplete(true);
                created = true;
                updated = true;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.