Package org.eclipse.core.resources

Examples of org.eclipse.core.resources.IFile.create()


                    {
                        mkdirs((IFolder) file.getParent(), monitor);

                        InputStream in = FileLocator.openStream(b, new Path(sourcePath),
                            false);
                        file.create(in, true, monitor);
                    }

                    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
                    FileEditorInput input = new FileEditorInput(file);
                    window.getActivePage().openEditor(input, editorID);
View Full Code Here


        } else {
            /* TODO progress monitor */
          if (!destinationFile.getParent().exists()) {
            createParents(destinationFile.getParent());
          }
          destinationFile.create(new ByteArrayInputStream(node), true, null);
        }

        removeTouchedResource(destinationFile);

        destinationFile.setSessionProperty(ResourceUtil.QN_IMPORT_MODIFICATION_TIMESTAMP,
View Full Code Here

            IFile file = current.getFile(Path.fromPortableString(fileLocation.segments()[fileLocation
                    .segmentCount() - 1]));
            if (file.exists()) {
                file.setContents(contents, true, true, new NullProgressMonitor());
            } else {
                file.create(contents, true, new NullProgressMonitor());
            }
        } finally {
            IOUtils.closeQuietly(contents);
        }
View Full Code Here

                xml = document.toXML();
            }
            if (file.exists()) {
                file.setContents(new ByteArrayInputStream(xml.getBytes()), true, true, new NullProgressMonitor());
            } else {
                file.create(new ByteArrayInputStream(xml.getBytes()), true, new NullProgressMonitor());
            }
        } catch (Exception e) {
            //TODO proper logging
            e.printStackTrace();
            MessageDialog.openInformation(Display.getDefault().getActiveShell(),
View Full Code Here

        if (file.exists()) {
            // file already exists
            return;
        }
        try {
            file.create(new ByteArrayInputStream("".getBytes()), true, new NullProgressMonitor());
        } catch (CoreException e) {
            //TODO proper logging
            e.printStackTrace();
            MessageDialog.openWarning(Display.getDefault().getActiveShell(),
                    "Cannot create file "+filename, "Following Exception encountered: "+e);
View Full Code Here

      String templateJavaFile = DirUtil.mapSrcToJava(f.getProjectRelativePath().toString());
      IFile jFile = f.getProject().getFile(templateJavaFile);

      if (!jFile.exists()) {
        jFile.create(is, true, null);
      } else {
        setReadOnly(jFile, false);
         jFile.setContents(is, IFile.FORCE, null);
//        jFile.setContents(is, 0, null);
        // don't use force seems safer
View Full Code Here

      else {
        // create a sample layout and tag
        file = proj.getFile("app/japidviews/_layouts/SampleLayout.html");
        if (!file.exists()) {
          try {
            file.create(new ByteArrayInputStream(SAMPLE_LAYOUT.getBytes("UTF-8")), true, null);
          } catch (Exception e) {
            PlayPlugin.showError(e);
          }
        }
       
View Full Code Here

        }
       
        file = proj.getFile("app/japidviews/_tags/SampleTag.html");
        if (!file.exists()) {
          try {
            file.create(new ByteArrayInputStream(SAMPLE_TAG.getBytes("UTF-8")), true, null);
          } catch (Exception e) {
            PlayPlugin.showError(e);
          }
        }
View Full Code Here

        IFolder folder = project.getProject().getFolder("src/main/resources/com/sample");
        createFolder(folder, monitor);
        IFile file = folder.getFile("sample.bpmn");
        InputStream inputstream = getClass().getClassLoader().getResourceAsStream(fileName);
        if (!file.exists()) {
            file.create(inputstream, true, monitor);
        } else {
            file.setContents(inputstream, true, false, monitor);
        }
    }
View Full Code Here

        IFolder folder = project.getProject().getFolder("src/main/resources/META-INF");
        createFolder(folder, monitor);
        IFile file = folder.getFile("kmodule.xml");
        InputStream inputstream = getClass().getClassLoader().getResourceAsStream(fileName);
        if (!file.exists()) {
            file.create(inputstream, true, monitor);
        } else {
            file.setContents(inputstream, true, false, monitor);
        }
    }
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.