Examples of IFile


Examples of org.eclipse.core.resources.IFile

        for (IResource child : container.members()) {
          List<LocalFSDesignResourceState> childStates = buildFSDesignResourceStates(child, base);
          states.addAll(childStates);
        }
      } else if (resource instanceof IFile) {
        IFile file = (IFile) resource;
        state.setType(FSDesignResourceState.TYPE_FILE);
        state.setLastmodified(file.getLocalTimeStamp());
        try {
          state.setMd5sum(WGUtils.createMD5HEX(file.getContents()));
        } catch (Exception e) {
          WGADesignerPlugin.getDefault().logError("Unable to compute md5 sum of resource '" + file.getLocation().toString() + "'.", e);
        }
      }
    }
    return states;
  }
View Full Code Here

Examples of org.eclipse.core.resources.IFile

      for (IResource child : container.members()) {
        List<LocalFSDesignResourceState> childStates = buildDirLinkFSDesignResourceStates(linkTarget, linkName, child);
        states.addAll(childStates);
      }
    } else if (resource instanceof IFile) {
      IFile file = (IFile) resource;
      state.setType(FSDesignResourceState.TYPE_FILE);
      state.setLastmodified(file.getLocalTimeStamp());
      try {
        state.setMd5sum(WGUtils.createMD5HEX(file.getContents()));
      } catch (Exception e) {
        WGADesignerPlugin.getDefault().logError("Unable to compute md5 sum of resource '" + file.getLocation().toString() + "'.", e);
      }
    }   
    return states;
  }
View Full Code Here

Examples of org.eclipse.core.resources.IFile

          } catch (Exception e) {           
          }
        }
                     
        // modify plugin config and open plugin design editor
        IFile syncInfo = new WGADesignStructureHelper(designProject.getDesignFolder()).getSyncInfo();
        WGADesignConfigurationModel model = new WGADesignConfigurationModelWrapper(syncInfo);
       

                model.setVersionCompliance(Activator.DEFAULT_VERSION_COMPLIANCE);
              
View Full Code Here

Examples of org.eclipse.core.resources.IFile

        }
       
        String param = event.getParameter(PARAM_TMLFilePath);
        if (param != null) {
            Path path = new Path(param);
            IFile tmlFile = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
            String dbkey = OpenModulInBrowser.determineContentStoreOfFile(tmlFile);
            if (dbkey == null) {
                throw new ExecutionException("None of the web applications of the current runtime are connected to this design resource.");
            }
            OpenModulInBrowser.openBrowser(dbkey, tmlFile);
View Full Code Here

Examples of org.eclipse.core.resources.IFile

   * @throws IOException
   *             - when createDefaultIsMissing is true and default config
   *             cannot be created
   */
  public WGAConfiguration retrieveWGAConfig(boolean createDefaultIfMissing) throws IncompatibleWGAConfigVersion, IOException {
    IFile wgaXML = getWGAConfigFile();
    if (wgaXML == null) {
      // this nature is not configured yet
      return null;
    }
    if (!wgaXML.exists()) {
      if (!createDefaultIfMissing) {
        return null;
      } else {
        // create default config
        WGAConfiguration config = WGAConfiguration.createDefaultConfig();
        // int segmentCount =
        // _wgaBase.getLocation().matchingFirstSegments(_luceneRoot.getLocation());
        // IPath relativeLucenePath =
        // _luceneRoot.getLocation().removeFirstSegments(segmentCount);
        // config.getLuceneManagerConfiguration().setPath(relativeLucenePath.toString());
        // config.getDesignConfiguration().getDesignSource(Constants.DESIGNCOL_FILESYSTEM).getOptions().put("path",
        // "../designs");
        Domain defaultDomain = config.getDefaultDomain();
        defaultDomain.setDefaultManager("managers");
        defaultDomain.createFileBasedAuthentication("auth.xml");

        config.getServerOptions().put(WGAConfiguration.SERVEROPTION_SERVER_NAME, getName());
        if (getRootURL() != null) {
          config.getServerOptions().put(WGAConfiguration.SERVEROPTION_ROOT_URL, getRootURL().toString());
        }

        // disable install wizard
        config.setRunWizard(false);
       
        saveWGAConfig(config);
        return config;
      }
    } else {

      synchronized (_wgaConfigLock) {
        FileInputStream wgaXMLStream = null;
        try {
          wgaXMLStream = new FileInputStream(wgaXML.getLocation().toFile());
          WGAConfiguration conf = WGAConfiguration.read(wgaXMLStream);
          return conf;
        } catch (Exception e) {
          IncompatibleWGAConfigVersion notConfigurable = new IncompatibleWGAConfigVersion("Unable to read wga configuration.", e);
          throw notConfigurable;
View Full Code Here

Examples of org.eclipse.core.resources.IFile

    synchronized (_wgaConfigLock) {

      FileOutputStream wgaxmlstream = null;
      try {
          IFile wgaConfig = getWGABase().getFile(new Path("wgaconfig.xml"));
          if (wgaConfig.exists() && wgaConfig.isReadOnly()) {
                    ResourceAttributes attributes = wgaConfig.getResourceAttributes();
                    attributes.setReadOnly(false);
                    wgaConfig.setResourceAttributes(attributes);               
          }
        wgaxmlstream = new FileOutputStream(wgaConfig.getLocation().toFile());
        WGAConfiguration.write(config, wgaxmlstream);
        _wgaBase.refreshLocal(IResource.DEPTH_ONE, null);
      } catch (Exception e) {
        IOException ioe = new IOException("Unable to save wga configuration.");
        ioe.setStackTrace(e.getStackTrace());
View Full Code Here

Examples of org.eclipse.core.resources.IFile

  }

  public void flushConfig() throws CoreException {
    FileOutputStream configFileStream = null;
    try {
      IFile configFile = getConfigFile();
      if (configFile.isReadOnly()) {
        ResourceAttributes attributes = configFile.getResourceAttributes(); // ResourceAttributes.fromFile(configFile.getLocation().toFile());
        attributes.setReadOnly(false);
        configFile.setResourceAttributes(attributes);
      }

      // we might have to update root url bc. of distribution changes
      if (getRootURL() != null) {
        WGAConfiguration wgaConfig = retrieveWGAConfig(false);
        if (wgaConfig != null) {
          wgaConfig.getServerOptions().put(WGAConfiguration.SERVEROPTION_ROOT_URL, getRootURL().toString());
          saveWGAConfig(wgaConfig);
        }
      }
      configFileStream = new FileOutputStream(configFile.getLocation().toFile());
      WGARuntimeConfiguration.write(_config, configFileStream);

      _project.refreshLocal(IResource.DEPTH_ONE, null);
    } catch (Exception e) {
      WGADesignerPlugin.getDefault().logError("Unable to save config of runtime '" + getName() + "'.", e);
View Full Code Here

Examples of org.eclipse.core.resources.IFile

    super.finalize();
  }

  public void resourceChanged(IResourceChangeEvent event) {
    if (event.getDelta() != null) {
      IFile wgaconfig = getWGAConfigFile();
      if (wgaconfig != null && wgaconfig.isAccessible()) {
        IResourceDelta delta = event.getDelta().findMember(getWGAConfigFile().getFullPath());
        if (delta != null) {
          // wga config changed
          fireWGAConfigurationChanged();
        }
View Full Code Here

Examples of org.eclipse.core.resources.IFile

    }

    public void apply(IDocument document) {
      IResource resource = _markerAnnotation.getMarker().getResource();
      if (resource instanceof IFile) {
        IFile referer = (IFile) resource;
        IFolder tmlFolder = new WGADesignStructureHelper(referer).getTmlRoot();
        IFile fileToCreate = tmlFolder.getFile(new Path(_refPath));
        if (!fileToCreate.exists()) {
          try {
            // mkdir
            IContainer parent = fileToCreate.getParent();
            List<IFolder> foldersToCreate = new ArrayList<IFolder>();
            while (!parent.exists()) {
              if (parent instanceof IFolder) {
                foldersToCreate.add((IFolder)parent);
              }
              parent = parent.getParent();
            }
            for (int i=foldersToCreate.size() - 1; i >= 0; i--) {
              foldersToCreate.get(i).create(false, true, new NullProgressMonitor());
            }           
            // create tml file           
                  String header = Plugin.getDefault().getHeaderFileMap().get(Plugin.HEADER_TML_MODUL).getHeaderForProject(fileToCreate.getProject())
                  fileToCreate.create(new ByteArrayInputStream(header.getBytes()), true, new NullProgressMonitor());             
            // open editor
            WorkbenchUtils.openEditor(Plugin.getDefault().getWorkbench(), fileToCreate, ResourceIDs.EDITOR_TML);
          } catch (CoreException e) {
          }       
        }
View Full Code Here

Examples of org.eclipse.core.resources.IFile

    }

    public void apply(IDocument document) {
      IResource resource = _markerAnnotation.getMarker().getResource();
      if (resource instanceof IFile) {
        IFile referer = (IFile) resource;
        WGADesignStructureHelper helper = new WGADesignStructureHelper(referer);
        IFolder scriptFolder = helper.getScriptsRoot();
        IFile fileToCreate = scriptFolder.getFile(new Path(_refPath));
        if (!fileToCreate.exists()) {
          try {
            // mkdir
            IContainer parent = fileToCreate.getParent();
            List<IFolder> foldersToCreate = new ArrayList<IFolder>();
            while (!parent.exists()) {
              if (parent instanceof IFolder) {
                foldersToCreate.add((IFolder)parent);
              }
              parent = parent.getParent();
            }
            for (int i=foldersToCreate.size() - 1; i >= 0; i--) {
              foldersToCreate.get(i).create(false, true, new NullProgressMonitor());
            }           
            // create tml file
            fileToCreate.create(new ByteArrayInputStream(new byte[0]), true, new NullProgressMonitor());
            // open editor
            WorkbenchUtils.openEditor(Plugin.getDefault().getWorkbench(), fileToCreate);
          } catch (CoreException e) {
          }       
        }
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.