Added support for pluggable descriptor.proto definitions.
diff --git a/com.google.eclipse.protobuf/plugin.xml b/com.google.eclipse.protobuf/plugin.xml
index c9018bb..ffd7ad0 100644
--- a/com.google.eclipse.protobuf/plugin.xml
+++ b/com.google.eclipse.protobuf/plugin.xml
@@ -2,6 +2,7 @@
 <?eclipse version="3.0"?>
 
 <plugin>
+   <extension-point id="descriptorSource" name="Source of descriptor.proto" schema="schema/descriptor-source.exsd"/>
 
   <extension point="org.eclipse.emf.ecore.generated_package">
     <package 
diff --git a/com.google.eclipse.protobuf/schema/descriptor-source.exsd b/com.google.eclipse.protobuf/schema/descriptor-source.exsd
new file mode 100644
index 0000000..98b9724
--- /dev/null
+++ b/com.google.eclipse.protobuf/schema/descriptor-source.exsd
@@ -0,0 +1,93 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="com.google.eclipse.protobuf" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+      <appInfo>
+         <meta.schema plugin="com.google.eclipse.protobuf" id="descriptorSource" name="Source of descriptor.proto"/>
+      </appInfo>
+      <documentation>
+         Provides the contents of a descriptor.proto file.
+      </documentation>
+   </annotation>
+
+   <element name="extension">
+      <annotation>
+         <appInfo>
+            <meta.element />
+         </appInfo>
+      </annotation>
+      <complexType>
+         <sequence>
+            <element ref="source"/>
+         </sequence>
+         <attribute name="point" type="string" use="required">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="id" type="string">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="name" type="string">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+               <appInfo>
+                  <meta.attribute translatable="true"/>
+               </appInfo>
+            </annotation>
+         </attribute>
+      </complexType>
+   </element>
+
+   <element name="source">
+      <complexType>
+         <attribute name="class" type="string">
+            <annotation>
+               <documentation>
+                  Provides the contents of a descriptor.proto file.
+               </documentation>
+               <appInfo>
+                  <meta.attribute kind="java" basedOn=":com.google.eclipse.protobuf.scoping.IProtoDescriptorSource"/>
+               </appInfo>
+            </annotation>
+         </attribute>
+      </complexType>
+   </element>
+
+   <annotation>
+      <appInfo>
+         <meta.section type="since"/>
+      </appInfo>
+      <documentation>
+         1.0.3
+      </documentation>
+   </annotation>
+
+
+
+
+   <annotation>
+      <appInfo>
+         <meta.section type="copyright"/>
+      </appInfo>
+      <documentation>
+         Copyright (c) 2011 Google, Inc.
+
+All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at 
+
+http://www.eclipse.org/legal/epl-v10.html
+
+Contributors:
+Google, Inc. - initial API and implementation
+      </documentation>
+   </annotation>
+
+</schema>
diff --git a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/ProtobufRuntimeModule.java b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/ProtobufRuntimeModule.java
index 8fbb052..b3dcf8d 100644
--- a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/ProtobufRuntimeModule.java
+++ b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/ProtobufRuntimeModule.java
@@ -8,12 +8,13 @@
  */
 package com.google.eclipse.protobuf;
 
+import org.eclipse.core.runtime.IExtensionRegistry;
 import org.eclipse.xtext.naming.IQualifiedNameProvider;
 import org.eclipse.xtext.parser.antlr.ISyntaxErrorMessageProvider;
 import org.eclipse.xtext.scoping.impl.ImportUriResolver;
 
 import com.google.eclipse.protobuf.naming.ProtobufQualifiedNameProvider;
-import com.google.eclipse.protobuf.scoping.ProtobufImportUriResolver;
+import com.google.eclipse.protobuf.scoping.*;
 import com.google.eclipse.protobuf.validation.ProtobufSyntaxErrorMessageProvider;
 import com.google.inject.Binder;
 
@@ -34,4 +35,8 @@
   public void configureSyntaxErrorMessageProvider(Binder binder) {
     binder.bind(ISyntaxErrorMessageProvider.class).to(ProtobufSyntaxErrorMessageProvider.class);
   }
+  
+  public void configureExtensionRegistry(Binder binder) {
+    binder.bind(IExtensionRegistry.class).toProvider(ExtensionRegistryProvider.class);
+  }
 }
diff --git a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/ExtensionRegistryProvider.java b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/ExtensionRegistryProvider.java
new file mode 100644
index 0000000..c88fd49
--- /dev/null
+++ b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/ExtensionRegistryProvider.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2011 Google Inc.
+ *
+ * All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse
+ * Public License v1.0 which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ */
+package com.google.eclipse.protobuf.scoping;
+
+import com.google.inject.*;
+
+import org.eclipse.core.runtime.*;
+
+/**
+ * Provider of instances of <code>{@link IExtensionRegistry}</code>.
+ * 
+ * @author alruiz@google.com (Alex Ruiz)
+ */
+@Singleton
+public class ExtensionRegistryProvider implements Provider<IExtensionRegistry> {
+
+  public IExtensionRegistry get() {
+    return Platform.getExtensionRegistry();
+  }
+}
diff --git a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/ProtoDescriptorProvider.java b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/ProtoDescriptorProvider.java
index b235efb..e394477 100644
--- a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/ProtoDescriptorProvider.java
+++ b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/ProtoDescriptorProvider.java
@@ -11,6 +11,8 @@
 import com.google.eclipse.protobuf.util.ModelNodes;
 import com.google.inject.*;
 
+import org.apache.log4j.Logger;
+import org.eclipse.core.runtime.*;
 import org.eclipse.xtext.parser.IParser;
 
 /**
@@ -21,14 +23,34 @@
 @Singleton
 public class ProtoDescriptorProvider implements Provider<ProtoDescriptor> {
 
+  private static final String EXTENSION_ID = "com.google.eclipse.protobuf.descriptorSource";
+
+  private static Logger logger = Logger.getLogger(ProtoDescriptorProvider.class);
+  
   @Inject private IParser parser;
   @Inject private IProtoDescriptorSource source;
   @Inject private ModelNodes nodes;
+  @Inject private IExtensionRegistry registry;
 
   private ProtoDescriptor descriptor;
 
   public synchronized ProtoDescriptor get() {
-    if (descriptor == null) descriptor = new ProtoDescriptor(parser, source, nodes);
+    IProtoDescriptorSource actualSource = sourceFromPlugin();
+    if (actualSource == null) actualSource = source;
+    if (descriptor == null) descriptor = new ProtoDescriptor(parser, actualSource, nodes);
     return descriptor;
   }
+  
+  private IProtoDescriptorSource sourceFromPlugin() {
+    IConfigurationElement[] config = registry.getConfigurationElementsFor(EXTENSION_ID);
+    try {
+      for (IConfigurationElement e : config) {
+        Object extension = e.createExecutableExtension("class");
+        if (extension instanceof IProtoDescriptorSource) return (IProtoDescriptorSource) extension;
+      }
+    } catch (CoreException t) {
+      logger.fatal("Unable to instantiate extension elements", t);
+    }
+    return null;
+  }
 }