Domanda

Inside my Perspective class I have created myproject with the following code;

private void createProject() throws CoreException {

        myWorkspaceRoot = ResourcesPlugin.getWorkspace().getRoot();

        myProject = myWorkspaceRoot.getProject("my");

        if( !myProject.exists() ) {
            myProject.create(null);
        }

        if(!myProject.isOpen() ) {
            myProject.open(null);
        }

        imagesFolder = myProject.getFolder("images");
        if (!imagesFolder.exists()) {
            imagesFolder.create(false, false, null);

        }


        fontsFolder = myProject.getFolder("fonts");

        if (!fontsFolder.exists()) {
            fontsFolder.create(false, false, null);
        }


    }

Actually, in the filesystem, the project directory was created, but fonts and images directory were not.

How to flush workspace to disk or how to do some other operation so that actual folder appear on the filesystem?

È stato utile?

Soluzione

The second parameter of IFolder.create is the local flag which says that the folder is in the local file system - you are specifying false so the part of the code which creates the local folder is not called. Use

IFolder.create(false, true, null);
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top