Package org.eclipse.core.resources

Examples of org.eclipse.core.resources.IWorkspaceRunnable


 
 
   public static void addBuilder(IProject project, String id) throws CoreException {
       final IProject fProject = project;
       final String fId = id;
       IWorkspaceRunnable operation = new IWorkspaceRunnable() {
          public void run(IProgressMonitor monitor) throws CoreException {                       
            if (fProject.isAccessible()) {
              ResourceAttributes attribs = fProject.getResourceAttributes();
              if (attribs != null && attribs.isReadOnly()) {
                attribs.setReadOnly(false);
View Full Code Here


     }
  
   public static void removeBuilder(IProject project, String id) throws CoreException {
       final IProject fProject = project;
       final String fId = id;
       IWorkspaceRunnable operation = new IWorkspaceRunnable() {
          public void run(IProgressMonitor monitor) throws CoreException {                       
            if (fProject.isAccessible()) {
              ResourceAttributes attribs = fProject.getResourceAttributes();
              if (attribs != null && attribs.isReadOnly()) {
                attribs.setReadOnly(false);
View Full Code Here

    protected IJavaProject createJavaProject(final String projectName,
        final String[] sourceFolders, final String[] libraries,
        final String projectOutput, final String compliance)
        throws CoreException {
        final IJavaProject[] result = new IJavaProject[1];
        IWorkspaceRunnable create = new IWorkspaceRunnable() {

            public void run(IProgressMonitor monitor) throws CoreException {
                // create project
                createProject(projectName);
View Full Code Here

        throws CoreException {
        final IProject project1 = root.getProject(projectName);

        deleteProject(project1);

        IWorkspaceRunnable create = new IWorkspaceRunnable() {

            public void run(IProgressMonitor monitor) throws CoreException {
                project1.create(null);
                project1.open(null);
            }
View Full Code Here

      String newVersionNumber = Byte.toString(State.VERSION);
      if (!newVersionNumber.equals(versionNumber)) {
        // build state version number has changed: touch every projects to force a rebuild
        if (JavaBuilder.DEBUG)
          System.out.println("Build state version number has changed"); //$NON-NLS-1$
        IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
          public void run(IProgressMonitor progressMonitor2) throws CoreException {
            IJavaProject[] projects = null;
            try {
              projects = model.getJavaProjects();
            } catch (JavaModelException e) {
View Full Code Here

        }
       
        // touch the projects to force them to be recompiled while taking the workspace lock
        // so that there is no concurrency with the Java builder
        // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=96575
        IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
          public void run(IProgressMonitor progressMonitor) throws CoreException {
            for (int i = 0; i < length; i++) {
              IProject project = projectsToTouch[i];
             
              // touch to force a build of this project
View Full Code Here

        return result;
    }

    private static void generatePackageInfos(final Collection< ? extends File> pkgDirs) throws CoreException {
        final IWorkspaceRunnable wsOperation = new IWorkspaceRunnable() {
            public void run(IProgressMonitor monitor) throws CoreException {
                SubMonitor progress = SubMonitor.convert(monitor, pkgDirs.size());
                MultiStatus status = new MultiStatus(Plugin.PLUGIN_ID, 0, "Errors occurred while creating packageinfo files.", null);
                for (File pkgDir : pkgDirs) {
                    IContainer[] locations = ResourcesPlugin.getWorkspace().getRoot().findContainersForLocationURI(pkgDir.toURI());
View Full Code Here

        if (changed)
            javaProject.setRawClasspath(newEntries.toArray(new IClasspathEntry[newEntries.size()]), null);
    }

    private void updateProject(final IProjectDescription desc, final boolean adding) throws CoreException {
        IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
            public void run(IProgressMonitor monitor) throws CoreException {
                project.setDescription(desc, monitor);
                if (adding) {
                    installBndClasspath();
                } else {
View Full Code Here

                            // Generate the Bnd model
                            final BndEditModel bndModel = generateBndModel(progress.newChild(1));

                            // Make changes to the project
                            final IWorkspaceRunnable op = new IWorkspaceRunnable() {
                                public void run(IProgressMonitor monitor) throws CoreException {
                                    processGeneratedProject(ProjectPaths.get(pageOne.getProjectLayout()), bndModel, javaProj, monitor);
                                }
                            };
                            javaProj.getProject().getWorkspace().run(op, progress.newChild(2));
View Full Code Here

                @Override
                public void run(IMarker marker) {
                    final IFile file = (IFile) marker.getResource();
                    final IWorkspace workspace = file.getWorkspace();
                    try {
                        workspace.run(new IWorkspaceRunnable() {
                            @Override
                            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

TOP

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

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.