plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/project/WRT11ApplicationLayout.java
changeset 479 518afa7c6d2f
parent 472 bd9f2d7c64a6
child 483 109da596fa9d
equal deleted inserted replaced
478:6c07c755d0c7 479:518afa7c6d2f
    33 import org.eclipse.core.runtime.CoreException;
    33 import org.eclipse.core.runtime.CoreException;
    34 import org.eclipse.core.runtime.IPath;
    34 import org.eclipse.core.runtime.IPath;
    35 import org.eclipse.core.runtime.IStatus;
    35 import org.eclipse.core.runtime.IStatus;
    36 import org.eclipse.core.runtime.Path;
    36 import org.eclipse.core.runtime.Path;
    37 import org.eclipse.core.runtime.Status;
    37 import org.eclipse.core.runtime.Status;
    38 import org.symbian.tools.tmw.previewer.core.IApplicationLayoutProvider;
    38 import org.symbian.tools.tmw.core.runtimes.IApplicationLayoutProvider;
    39 import org.symbian.tools.wrttools.Activator;
    39 import org.symbian.tools.wrttools.Activator;
    40 import org.symbian.tools.wrttools.util.CoreUtil;
    40 import org.symbian.tools.wrttools.util.CoreUtil;
    41 import org.symbian.tools.wrttools.util.ProjectUtils;
    41 import org.symbian.tools.wrttools.util.ProjectUtils;
    42 
    42 
    43 public class WRT11ApplicationLayout implements IApplicationLayoutProvider {
    43 public class WRT11ApplicationLayout implements IApplicationLayoutProvider {
    52     }
    52     }
    53 
    53 
    54     private IFile getProjectIndexPage(String projectName) throws IOException, CoreException {
    54     private IFile getProjectIndexPage(String projectName) throws IOException, CoreException {
    55         IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
    55         IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
    56         if (project.isAccessible()) {
    56         if (project.isAccessible()) {
    57             String indexFileName = CoreUtil.getIndexFile(project);
    57             final IFile file = CoreUtil.getIndexFile(project);
    58             if (indexFileName != null) {
    58             if (file != null && !ProjectUtils.isExcluded(file)) {
    59                 final IFile file = CoreUtil.getFile(project, indexFileName);
    59                 return file;
    60                 if (!ProjectUtils.isExcluded(file)) {
       
    61                     return file;
       
    62                 }
       
    63             }
    60             }
    64             Activator.log(
    61             Activator.log(String.format("Can not find main page in project %s.\n", project.getName()), null);
    65                     String.format("Can not find main page (%s) in project %s.\n", indexFileName, project.getName()),
       
    66                     null);
       
    67         }
    62         }
    68         return null;
    63         return null;
    69     }
    64     }
    70 
    65 
    71     private InputStream patchIndexFile(final IFile file) throws CoreException, UnsupportedEncodingException {
    66     private InputStream patchIndexFile(final IFile file) throws CoreException, UnsupportedEncodingException {
   149             }
   144             }
   150         }
   145         }
   151         return (file != null && file.exists()) && isFileIncluded(file) ? file : null;
   146         return (file != null && file.exists()) && isFileIncluded(file) ? file : null;
   152     }
   147     }
   153 
   148 
       
   149     public IFile getIndexPage(IProject project) {
       
   150         try {
       
   151             return CoreUtil.getIndexFile(project);
       
   152         } catch (CoreException e) {
       
   153             Activator.log(e);
       
   154             return null;
       
   155         }
       
   156     }
       
   157 
   154 }
   158 }