Package org.eclipse.jface.text.templates.persistence

Examples of org.eclipse.jface.text.templates.persistence.TemplateReaderWriter


            if (file != null) {
                InputStream stream = null;
                try {
                    final InputStream input = new FileInputStream(new File(file));
                    stream = new BufferedInputStream(input);
                    final TemplateReaderWriter reader = new TemplateReaderWriter();
                    final TemplatePersistenceData[] datas = reader.read(stream, null);
                    for (final TemplatePersistenceData data : datas) {
                        if (validateTemplate(data.getTemplate())) {
                            templates.add(data);
                        }
                    }
View Full Code Here


              bundle= new PropertyResourceBundle(bundleStream);
            }
          }

          stream= new BufferedInputStream(url.openStream());
          TemplateReaderWriter reader= new TemplateReaderWriter();
          TemplatePersistenceData[] datas= reader.read(stream, bundle);
          for (int i= 0; i < datas.length; i++) {
            TemplatePersistenceData data= datas[i];
            if (data.isCustom()) {
              if (data.getId() == null)
                EditorsPlugin.logErrorMessage(NLSUtility.format(ContributionTemplateMessages.ContributionTemplateStore_ignore_no_id, data.getTemplate().getName()));
View Full Code Here

      return;
   
    IFileStore fileStore= EFS.getLocalFileSystem().getStore(new Path(path));

    try {
      TemplateReaderWriter reader= new TemplateReaderWriter();
      if (fileStore.fetchInfo().exists()) {
        InputStream input= new BufferedInputStream(fileStore.openInputStream(EFS.NONE, null));
        try {
          TemplatePersistenceData[] datas= reader.read(input, null);
          for (int i= 0; i < datas.length; i++) {
            TemplatePersistenceData data= datas[i];
            fTemplateStore.add(data);
          }
        } finally {
View Full Code Here

    if (!fileInfo.exists() || confirmOverwrite(fileStore)) {
      OutputStream output= null;
      try {
        output= new BufferedOutputStream(fileStore.openOutputStream(EFS.NONE, null));
        TemplateReaderWriter writer= new TemplateReaderWriter();
        writer.save(templates, output);
      } catch (CoreException e) {
        openWriteErrorDialog();
      } catch (IOException e) {
        openWriteErrorDialog();
      } finally {
View Full Code Here

    if (path == null)
      return;

    try {
      TemplateReaderWriter reader= new TemplateReaderWriter();
      File file= new File(path);
      if (file.exists()) {
        InputStream input= new BufferedInputStream(new FileInputStream(file));
        try {
          TemplatePersistenceData[] datas= reader.read(input, null);
          for (int i= 0; i < datas.length; i++) {
            TemplatePersistenceData data= datas[i];
            fTemplateStore.add(data);
          }
        } finally {
View Full Code Here

    if (!file.exists() || confirmOverwrite(file)) {
      OutputStream output= null;
      try {
        output= new BufferedOutputStream(new FileOutputStream(file));
        TemplateReaderWriter writer= new TemplateReaderWriter();
        writer.save(templates, output);
      } catch (IOException e) {
        openWriteErrorDialog(e);
      } finally {
        if (output != null) {
          try {
View Full Code Here

    if (path == null)
      return;

    try {
      TemplateReaderWriter reader = new TemplateReaderWriter();
      File file = new File(path);
      if (file.exists()) {
        InputStream input = new BufferedInputStream(
            new FileInputStream(file));
        try {
          TemplatePersistenceData[] datas = reader.read(input, null);
          for (int i = 0; i < datas.length; i++) {
            updateTemplate(datas[i]);
          }
        } finally {
          try {
View Full Code Here

    if (!file.exists() || confirmOverwrite(file)) {
      OutputStream output = null;
      try {
        output = new BufferedOutputStream(new FileOutputStream(file));
        TemplateReaderWriter writer = new TemplateReaderWriter();
        writer.save(templates, output);
        output.close();
      } catch (IOException e) {
        if (output != null) {
          try {
            output.close();
View Full Code Here

        }

        public void save() throws IOException {

          StringWriter output = new StringWriter();
          TemplateReaderWriter writer = new TemplateReaderWriter();
          writer.save(getTemplateData(false), output);

          projectSettings.setValue(KEY, output.toString());
          projectSettings.save();
        }
      };
View Full Code Here

    }
    String pref = new ProjectScope(project).getNode(PHPUiPlugin.ID).get(
        KEY, null);
    if (pref != null && pref.trim().length() > 0) {
      Reader input = new StringReader(pref);
      TemplateReaderWriter reader = new TemplateReaderWriter();
      TemplatePersistenceData[] datas;
      try {
        datas = reader.read(input);
        return datas.length > 0;
      } catch (IOException e) {
        // ignore
      }
    }
View Full Code Here

TOP

Related Classes of org.eclipse.jface.text.templates.persistence.TemplateReaderWriter

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.