コード例 #1
0
 @Override
 protected IBaseModel createModel(IEditorInput input) throws CoreException {
   BundleModel model = null;
   boolean isReconciling = input instanceof IFileEditorInput;
   IDocument document = getDocumentProvider().getDocument(input);
   model = new BundleModel(document, isReconciling);
   if (input instanceof IFileEditorInput) {
     IFile file = ((IFileEditorInput) input).getFile();
     model.setUnderlyingResource(file);
     model.setCharset(file.getCharset());
   } else if (input instanceof IURIEditorInput) {
     IFileStore store = EFS.getStore(((IURIEditorInput) input).getURI());
     model.setInstallLocation(store.getParent().getParent().toString());
     model.setCharset(getDefaultCharset());
   } else if (input instanceof JarEntryEditorInput) {
     File file = (File) ((JarEntryEditorInput) input).getAdapter(File.class);
     model.setInstallLocation(file.toString());
     model.setCharset(getDefaultCharset());
   } else {
     model.setCharset(getDefaultCharset());
   }
   model.load();
   return model;
 }