### Eclipse Workspace Patch 1.0
#P org.xwiki.eclipse.ui
Index: src/main/java/org/xwiki/eclipse/ui/editors/contentassist/XWikiLinkContentAssistProcessor.java
===================================================================
--- src/main/java/org/xwiki/eclipse/ui/editors/contentassist/XWikiLinkContentAssistProcessor.java	(revision 18794)
+++ src/main/java/org/xwiki/eclipse/ui/editors/contentassist/XWikiLinkContentAssistProcessor.java	(working copy)
@@ -31,6 +31,7 @@
 import org.eclipse.jface.text.contentassist.IContextInformation;
 import org.eclipse.jface.text.contentassist.IContextInformationValidator;
 import org.xwiki.eclipse.core.DataManager;
+import org.xwiki.eclipse.core.Functionality;
 import org.xwiki.eclipse.core.model.XWikiEclipsePageSummary;
 import org.xwiki.eclipse.ui.UIPlugin;
 import org.xwiki.eclipse.ui.editors.utils.Utils;
@@ -54,15 +55,20 @@
 
         if (linkPrefix != null) {
             List<XWikiEclipsePageSummary> pageSummaries =
-                UIPlugin.getDefault().getAllPageSummariesForDataManager(dataManager);
+                UIPlugin.getDefault().getAllPageSummariesForDataManager(dataManager, linkPrefix);
 
             for (XWikiEclipsePageSummary pageSummary : pageSummaries) {
                 String pageId = pageSummary.getData().getId();
-                if (pageId.startsWith(linkPrefix)) {
+                if (pageId.startsWith(linkPrefix)
+                    || dataManager.getSupportedFunctionalities().contains(Functionality.EFFICIENT_RETRIEVAL)) {
                     result.add(new CompletionProposal(pageId, offset - linkPrefix.length(), linkPrefix.length(), pageId
                         .length(), null, pageId, null, null));
                 }
             }
+            if (dataManager.getSupportedFunctionalities().contains(Functionality.EFFICIENT_RETRIEVAL)) {
+                result
+                    .add(new CompletionProposal("", offset, 0, 0, null, "Type to Constrain Proposals...", null, null));
+            }
         }
 
         if (result.size() > 0) {
Index: src/main/java/org/xwiki/eclipse/ui/UIPlugin.java
===================================================================
--- src/main/java/org/xwiki/eclipse/ui/UIPlugin.java	(revision 18794)
+++ src/main/java/org/xwiki/eclipse/ui/UIPlugin.java	(working copy)
@@ -28,6 +28,8 @@
 import org.eclipse.ui.plugin.AbstractUIPlugin;
 import org.osgi.framework.BundleContext;
 import org.xwiki.eclipse.core.DataManager;
+import org.xwiki.eclipse.core.Functionality;
+import org.xwiki.eclipse.core.XWikiEclipseException;
 import org.xwiki.eclipse.core.model.XWikiEclipsePageSummary;
 import org.xwiki.eclipse.ui.utils.XWikiEclipseSafeRunnable;
 
@@ -87,15 +89,29 @@
         return imageDescriptorFromPlugin(PLUGIN_ID, path);
     }
 
-    public List<XWikiEclipsePageSummary> getAllPageSummariesForDataManager(final DataManager dataManager)
+    public List<XWikiEclipsePageSummary> getAllPageSummariesForDataManager(final DataManager dataManager,
+        final String linkPrefix)
     {
+
+        if (dataManager.getSupportedFunctionalities().contains(Functionality.EFFICIENT_RETRIEVAL)) {
+            List<XWikiEclipsePageSummary> pageSummaries;
+            try {
+                dataManagerToPageSummariesMap.clear();
+                pageSummaries = dataManager.getAllPageIds(linkPrefix);
+                dataManagerToPageSummariesMap.put(dataManager, pageSummaries);
+                return dataManagerToPageSummariesMap.get(dataManager);
+            } catch (XWikiEclipseException e) {
+                e.printStackTrace();
+            }
+        }
+
         /* If we don't already have summaries, then fetch them from the data manager */
         if (dataManagerToPageSummariesMap.get(dataManager) == null) {
             SafeRunner.run(new XWikiEclipseSafeRunnable()
             {
                 public void run() throws Exception
                 {
-                    List<XWikiEclipsePageSummary> pageSummaries = dataManager.getAllPageIds();
+                    List<XWikiEclipsePageSummary> pageSummaries = dataManager.getAllPageIds(linkPrefix);
                     dataManagerToPageSummariesMap.put(dataManager, pageSummaries);
                 }
             });
#P org.xwiki.eclipse.core
Index: src/main/java/org/xwiki/eclipse/core/DataManager.java
===================================================================
--- src/main/java/org/xwiki/eclipse/core/DataManager.java	(revision 18794)
+++ src/main/java/org/xwiki/eclipse/core/DataManager.java	(working copy)
@@ -144,6 +144,7 @@
         supportedFunctionalities.add(Functionality.RENAME);
         supportedFunctionalities.add(Functionality.TRANSLATIONS);
         supportedFunctionalities.add(Functionality.ALL_PAGES_RETRIEVAL);
+        supportedFunctionalities.add(Functionality.EFFICIENT_RETRIEVAL);
     }
 
     /*
@@ -224,6 +225,9 @@
 
             if (serverInfo.getBaseUrl().contains("xwiki")) {
                 if (serverInfo.getMajorVersion() == 1) {
+                    if (serverInfo.getMinorVersion() < 9) {
+                        supportedFunctionalities.remove(Functionality.EFFICIENT_RETRIEVAL);
+                    }
                     if (serverInfo.getMinorVersion() < 5) {
                         supportedFunctionalities.remove(Functionality.RENAME);
                     }
@@ -843,12 +847,24 @@
         return String.format("xwikieclipse://%s", getName()); //$NON-NLS-1$
     }
 
-    public List<XWikiEclipsePageSummary> getAllPageIds() throws XWikiEclipseException
+    public List<XWikiEclipsePageSummary> getAllPageIds(String linkPrefix) throws XWikiEclipseException
     {
         List<XWikiEclipsePageSummary> result = new ArrayList<XWikiEclipsePageSummary>();
 
         if (isConnected()) {
-            if (supportedFunctionalities.contains(Functionality.ALL_PAGES_RETRIEVAL)) {
+            if (supportedFunctionalities.contains(Functionality.EFFICIENT_RETRIEVAL)) {
+                java.util.HashMap map = new java.util.HashMap(6);
+                if (linkPrefix.equals("")) {
+                    linkPrefix = "__ALL_PAGES__";
+                }
+                map.put("searchedField", "fullname");
+                map.put("startIndex", "0");
+                map.put("maxResults", "25");
+                List<XWikiPageSummary> pageSummaries = remoteXWikiDataStorage.getConstrainedPageIds(linkPrefix, map);
+                for (XWikiPageSummary pageSummary : pageSummaries) {
+                    result.add(new XWikiEclipsePageSummary(this, pageSummary));
+                }
+            } else if (supportedFunctionalities.contains(Functionality.ALL_PAGES_RETRIEVAL)) {
                 List<XWikiPageSummary> pageSummaries = remoteXWikiDataStorage.getAllPageIds();
                 for (XWikiPageSummary pageSummary : pageSummaries) {
                     result.add(new XWikiEclipsePageSummary(this, pageSummary));
@@ -872,6 +888,11 @@
         return result;
     }
 
+    public List<XWikiEclipsePageSummary> getAllPageIds() throws XWikiEclipseException
+    {
+        return this.getAllPageIds("");
+    }
+
     public boolean exists(String pageId)
     {
         if (isConnected()) {
Index: src/main/java/org/xwiki/eclipse/core/storage/LocalXWikiDataStorage.java
===================================================================
--- src/main/java/org/xwiki/eclipse/core/storage/LocalXWikiDataStorage.java	(revision 18794)
+++ src/main/java/org/xwiki/eclipse/core/storage/LocalXWikiDataStorage.java	(working copy)
@@ -609,4 +609,10 @@
 
         return result;
     }
+
+    public List<XWikiPageSummary> getConstrainedPageIds(String linkPrefix, Map parameters) throws XWikiEclipseException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
 }
Index: src/main/java/org/xwiki/eclipse/core/Functionality.java
===================================================================
--- src/main/java/org/xwiki/eclipse/core/Functionality.java	(revision 18794)
+++ src/main/java/org/xwiki/eclipse/core/Functionality.java	(working copy)
@@ -25,5 +25,5 @@
  */
 public enum Functionality
 {
-    OBJECTS, RENAME, TRANSLATIONS, ALL_PAGES_RETRIEVAL
+    OBJECTS, RENAME, TRANSLATIONS, ALL_PAGES_RETRIEVAL, EFFICIENT_RETRIEVAL
 }
Index: src/main/java/org/xwiki/eclipse/core/storage/IDataStorage.java
===================================================================
--- src/main/java/org/xwiki/eclipse/core/storage/IDataStorage.java	(revision 18794)
+++ src/main/java/org/xwiki/eclipse/core/storage/IDataStorage.java	(working copy)
@@ -21,6 +21,7 @@
 package org.xwiki.eclipse.core.storage;
 
 import java.util.List;
+import java.util.Map;
 
 import org.codehaus.swizzle.confluence.SpaceSummary;
 import org.xwiki.eclipse.core.XWikiEclipseException;
@@ -76,4 +77,7 @@
     public List<XWikiPageHistorySummary> getPageHistory(String pageId) throws XWikiEclipseException;
 
     public List<XWikiPageSummary> getAllPageIds() throws XWikiEclipseException;
+
+    public List<XWikiPageSummary> getConstrainedPageIds(final String linkPrefix, final Map parameters)
+        throws XWikiEclipseException;
 }
Index: src/main/java/org/xwiki/eclipse/core/storage/RemoteXWikiDataStorage.java
===================================================================
--- src/main/java/org/xwiki/eclipse/core/storage/RemoteXWikiDataStorage.java	(revision 18794)
+++ src/main/java/org/xwiki/eclipse/core/storage/RemoteXWikiDataStorage.java	(working copy)
@@ -22,6 +22,7 @@
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 
 import org.apache.xmlrpc.XmlRpcException;
 import org.codehaus.swizzle.confluence.SearchResult;
@@ -322,4 +323,25 @@
 
         return result;
     }
+
+    public List<XWikiPageSummary> getConstrainedPageIds(final String linkPrefix, final Map parameters)
+        throws XWikiEclipseException
+    {
+        Assert.isTrue(!disposed);
+
+        List<XWikiPageSummary> result = new ArrayList<XWikiPageSummary>();
+
+        try {
+            List<SearchResult> searchResults = rpc.search(linkPrefix, parameters, 0);
+            for (SearchResult searchResult : searchResults) {
+                XWikiPageSummary pageSummary = new XWikiPageSummary();
+                pageSummary.setId(searchResult.getId());
+                pageSummary.setTitle(searchResult.getTitle());
+                result.add(pageSummary);
+            }
+        } catch (XmlRpcException e) {
+            throw new XWikiEclipseException(e);
+        }
+        return result;
+    }
 }
