Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 167010 | Differences between
and this patch

Collapse All | Expand All

(-)plugin.xml (+6 lines)
Lines 1019-1023 Link Here
1019
               value="0"/>
1019
               value="0"/>
1020
      </markerAttributeGrouping>
1020
      </markerAttributeGrouping>
1021
   </extension>
1021
   </extension>
1022
   <extension
1023
         point="org.eclipse.ui.internalQuickAccessProvider">
1024
      <provider
1025
            class="org.eclipse.ui.internal.ide.ResourceProvider">
1026
      </provider>
1027
   </extension>
1022
   
1028
   
1023
</plugin>
1029
</plugin>
(-)src/org/eclipse/ui/internal/ide/ResourceProvider.java (+133 lines)
Added Link Here
1
package org.eclipse.ui.internal.ide;
2
3
import java.util.ArrayList;
4
import java.util.List;
5
6
import org.eclipse.core.resources.IFile;
7
import org.eclipse.core.resources.IResource;
8
import org.eclipse.core.resources.IResourceProxy;
9
import org.eclipse.core.resources.IResourceProxyVisitor;
10
import org.eclipse.core.resources.IWorkspace;
11
import org.eclipse.core.resources.ResourcesPlugin;
12
import org.eclipse.core.runtime.CoreException;
13
import org.eclipse.core.runtime.IPath;
14
import org.eclipse.core.runtime.IStatus;
15
import org.eclipse.core.runtime.Path;
16
import org.eclipse.jface.resource.ImageDescriptor;
17
import org.eclipse.ui.IWorkbenchPage;
18
import org.eclipse.ui.IWorkbenchWindow;
19
import org.eclipse.ui.PartInitException;
20
import org.eclipse.ui.PlatformUI;
21
import org.eclipse.ui.ide.IDE;
22
import org.eclipse.ui.internal.incubator.AbstractElement;
23
import org.eclipse.ui.internal.incubator.AbstractProvider;
24
import org.eclipse.ui.statushandling.StatusManager;
25
26
/**
27
 * Provides the resources in the workspace
28
 * 
29
 * @since 3.3
30
 * 
31
 */
32
public class ResourceProvider extends AbstractProvider {
33
34
	static IWorkspace workspace;
35
36
	/**
37
	 * 
38
	 */
39
	public ResourceProvider() {
40
		workspace = ResourcesPlugin.getWorkspace();
41
	}
42
43
	public AbstractElement getElementForId(String id) {
44
		IResource resource = workspace.getRoot().findMember(
45
				Path.fromPortableString(id));
46
		return resource == null ? null : new ResourceElement(this, resource
47
				.getFullPath());
48
	}
49
50
	public AbstractElement[] getElements() {
51
		final List result = new ArrayList();
52
		try {
53
			workspace.getRoot().accept(new IResourceProxyVisitor() {
54
55
				public boolean visit(IResourceProxy proxy) {
56
					if (proxy.getType() == IResource.FILE && !proxy.isDerived()) {
57
						result.add(new ResourceElement(ResourceProvider.this,
58
								proxy.requestFullPath()));
59
					}
60
					return true;
61
				}
62
			}, 0);
63
		} catch (CoreException e) {
64
			StatusManager
65
					.getManager()
66
					.handle(
67
							StatusUtil
68
									.newStatus(
69
											IStatus.ERROR,
70
											"NON-NLSed: Error while retrieving workspace resources", e), //$NON-NLS-1$
71
							StatusManager.LOG);
72
		}
73
		return (AbstractElement[]) result.toArray(new AbstractElement[result
74
				.size()]);
75
	}
76
77
	public String getId() {
78
		return "org.eclipse.ui.ide.ResourceProvider"; //$NON-NLS-1$
79
	}
80
81
	public ImageDescriptor getImageDescriptor() {
82
		return null;
83
	}
84
85
	public String getName() {
86
		return "NON-NLSed: Resources"; //$NON-NLS-1$
87
	}
88
89
	private static class ResourceElement extends AbstractElement {
90
91
		private final IPath path;
92
93
		ResourceElement(ResourceProvider provider, IPath path) {
94
			super(provider);
95
			this.path = path;
96
		}
97
98
		public void execute() {
99
			IResource resource = workspace.getRoot().findMember(path);
100
			if (!resource.exists() || resource.getType() != IResource.FILE)
101
				return;
102
			IWorkbenchWindow window = PlatformUI.getWorkbench()
103
					.getActiveWorkbenchWindow();
104
			if (window == null)
105
				return;
106
			IWorkbenchPage activePage = window.getActivePage();
107
			if (activePage == null)
108
				return;
109
			try {
110
				IDE.openEditor(activePage, (IFile) resource);
111
			} catch (PartInitException e) {
112
				StatusManager.getManager().handle(
113
						StatusUtil.newStatus(IStatus.ERROR,
114
								"NON-NLSed: Error while opening editor", e), //$NON-NLS-1$
115
						StatusManager.SHOWANDLOG);
116
			}
117
		}
118
119
		public String getId() {
120
			return path.toPortableString();
121
		}
122
123
		public ImageDescriptor getImageDescriptor() {
124
			return null;
125
		}
126
127
		public String getLabel() {
128
			return path.lastSegment() + " - " + path.toString(); //$NON-NLS-1$
129
		}
130
		
131
	}
132
133
}
(-)plugin.xml (+1 lines)
Lines 46-51 Link Here
46
   <extension-point id="views" name="%ExtPoint.views" schema="schema/views.exsd"/>
46
   <extension-point id="views" name="%ExtPoint.views" schema="schema/views.exsd"/>
47
   <extension-point id="workingSets" name="%ExtPoint.workingSets" schema="schema/workingSets.exsd"/>
47
   <extension-point id="workingSets" name="%ExtPoint.workingSets" schema="schema/workingSets.exsd"/>
48
   <extension-point id="browserSupport" name="%ExtPoint.browserSupport" schema="schema/browserSupport.exsd"/>
48
   <extension-point id="browserSupport" name="%ExtPoint.browserSupport" schema="schema/browserSupport.exsd"/>
49
   <extension-point id="internalQuickAccessProvider" name="%ExtPoint.internalQuickAccessProvider" schema="schema/internalQuickAccessProvider.exsd"/>
49
   
50
   
50
   <extension
51
   <extension
51
         point="org.eclipse.ui.contexts">
52
         point="org.eclipse.ui.contexts">
(-)plugin.properties (+1 lines)
Lines 54-59 Link Here
54
ExtPoint.browserSupport = Browser Support
54
ExtPoint.browserSupport = Browser Support
55
ExtPoint.StatusHandler = Status Handler
55
ExtPoint.StatusHandler = Status Handler
56
ExtPoint.menus2 = Menus2
56
ExtPoint.menus2 = Menus2
57
ExtPoint.internalQuickAccessProvider = (INTERNAL/EXPERIMENTAL) Quick Access Provider
57
58
58
Views.Category.Basic = General
59
Views.Category.Basic = General
59
Views.IntroAdapter = Welcome
60
Views.IntroAdapter = Welcome
(-)schema/internalQuickAccessProvider.exsd (+109 lines)
Added Link Here
1
<?xml version='1.0' encoding='UTF-8'?>
2
<!-- Schema file written by PDE -->
3
<schema targetNamespace="org.eclipse.ui">
4
<annotation>
5
      <appInfo>
6
         <meta.schema plugin="org.eclipse.ui" id="internalQuickAccessProvider" name="%ExtPoint.internalQuickAccessProvider"/>
7
      </appInfo>
8
      <documentation>
9
         INTERNAL/EXPERIMENTAL - This extension point is used to add element providers to the &quot;Quick Access&quot; action.
10
      </documentation>
11
   </annotation>
12
13
   <element name="extension">
14
      <complexType>
15
         <sequence>
16
            <element ref="provider"/>
17
         </sequence>
18
         <attribute name="point" type="string" use="required">
19
            <annotation>
20
               <documentation>
21
                  
22
               </documentation>
23
            </annotation>
24
         </attribute>
25
         <attribute name="id" type="string">
26
            <annotation>
27
               <documentation>
28
                  
29
               </documentation>
30
            </annotation>
31
         </attribute>
32
         <attribute name="name" type="string">
33
            <annotation>
34
               <documentation>
35
                  
36
               </documentation>
37
               <appInfo>
38
                  <meta.attribute translatable="true"/>
39
               </appInfo>
40
            </annotation>
41
         </attribute>
42
      </complexType>
43
   </element>
44
45
   <element name="provider">
46
      <complexType>
47
         <attribute name="class" type="string" use="required">
48
            <annotation>
49
               <documentation>
50
                  
51
               </documentation>
52
               <appInfo>
53
                  <meta.attribute kind="java" basedOn="org.eclipse.ui.internal.incubator.AbstractProvider"/>
54
               </appInfo>
55
            </annotation>
56
         </attribute>
57
      </complexType>
58
   </element>
59
60
   <annotation>
61
      <appInfo>
62
         <meta.section type="since"/>
63
      </appInfo>
64
      <documentation>
65
         3.3
66
      </documentation>
67
   </annotation>
68
69
   <annotation>
70
      <appInfo>
71
         <meta.section type="examples"/>
72
      </appInfo>
73
      <documentation>
74
         [Enter extension point usage example here.]
75
      </documentation>
76
   </annotation>
77
78
   <annotation>
79
      <appInfo>
80
         <meta.section type="apiInfo"/>
81
      </appInfo>
82
      <documentation>
83
         [Enter API information here.]
84
      </documentation>
85
   </annotation>
86
87
   <annotation>
88
      <appInfo>
89
         <meta.section type="implementation"/>
90
      </appInfo>
91
      <documentation>
92
         [Enter information about supplied implementation of this extension point.]
93
      </documentation>
94
   </annotation>
95
96
   <annotation>
97
      <appInfo>
98
         <meta.section type="copyright"/>
99
      </appInfo>
100
      <documentation>
101
         Copyright (c) 2006 IBM Corporation and others.&lt;br&gt;
102
All rights reserved. This program and the accompanying materials are made
103
available under the terms of the Eclipse Public License v1.0 which accompanies
104
this distribution, and is available at &lt;a 
105
href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
106
      </documentation>
107
   </annotation>
108
109
</schema>
(-)Eclipse UI/org/eclipse/ui/internal/incubator/CtrlEAction.java (-11 / +47 lines)
Lines 3-14 Link Here
3
import java.util.ArrayList;
3
import java.util.ArrayList;
4
import java.util.HashMap;
4
import java.util.HashMap;
5
import java.util.LinkedList;
5
import java.util.LinkedList;
6
import java.util.List;
6
import java.util.Map;
7
import java.util.Map;
7
import java.util.StringTokenizer;
8
import java.util.StringTokenizer;
8
9
9
import org.eclipse.core.commands.AbstractHandler;
10
import org.eclipse.core.commands.AbstractHandler;
10
import org.eclipse.core.commands.ExecutionEvent;
11
import org.eclipse.core.commands.ExecutionEvent;
11
import org.eclipse.core.runtime.Assert;
12
import org.eclipse.core.runtime.Assert;
13
import org.eclipse.core.runtime.CoreException;
14
import org.eclipse.core.runtime.IConfigurationElement;
15
import org.eclipse.core.runtime.IStatus;
16
import org.eclipse.core.runtime.Platform;
12
import org.eclipse.jface.dialogs.IDialogSettings;
17
import org.eclipse.jface.dialogs.IDialogSettings;
13
import org.eclipse.jface.resource.DeviceResourceException;
18
import org.eclipse.jface.resource.DeviceResourceException;
14
import org.eclipse.jface.resource.ImageDescriptor;
19
import org.eclipse.jface.resource.ImageDescriptor;
Lines 35-41 Link Here
35
import org.eclipse.ui.internal.IWorkbenchGraphicConstants;
40
import org.eclipse.ui.internal.IWorkbenchGraphicConstants;
36
import org.eclipse.ui.internal.WorkbenchImages;
41
import org.eclipse.ui.internal.WorkbenchImages;
37
import org.eclipse.ui.internal.WorkbenchPlugin;
42
import org.eclipse.ui.internal.WorkbenchPlugin;
43
import org.eclipse.ui.internal.misc.StatusUtil;
38
import org.eclipse.ui.internal.progress.ProgressManagerUtil;
44
import org.eclipse.ui.internal.progress.ProgressManagerUtil;
45
import org.eclipse.ui.statushandling.StatusManager;
39
46
40
/**
47
/**
41
 * Experimental Action for search-based navigation to UI elements such as
48
 * Experimental Action for search-based navigation to UI elements such as
Lines 71-81 Link Here
71
		}
78
		}
72
79
73
		if (providers == null) {
80
		if (providers == null) {
74
			providers = new AbstractProvider[] { new PreviousPicksProvider(),
81
			List providerList = new ArrayList();
75
					new EditorProvider(), new ViewProvider(),
82
			providerList.add(new PreviousPicksProvider());
76
					new PerspectiveProvider(), new CommandProvider(),
83
			providerList.add(new EditorProvider());
77
					new ActionProvider(), new WizardProvider(),
84
			providerList.add(new ViewProvider());
78
					new PreferenceProvider() };
85
			providerList.add(new PerspectiveProvider());
86
			// add contributed providers
87
			IConfigurationElement[] elements = Platform.getExtensionRegistry()
88
					.getConfigurationElementsFor(
89
							"org.eclipse.ui.internalQuickAccessProvider"); //$NON-NLS-1$
90
			for (int i = 0; i < elements.length; i++) {
91
				AbstractProvider provider;
92
				try {
93
					provider = (AbstractProvider) elements[i]
94
							.createExecutableExtension("class"); //$NON-NLS-1$
95
					providerList.add(provider);
96
				} catch (CoreException e) {
97
					StatusManager
98
							.getManager()
99
							.handle(
100
									StatusUtil
101
											.newStatus(
102
													IStatus.ERROR,
103
													"NON-NLSed: Error with extension " + elements[i], e), //$NON-NLS-1$
104
									StatusManager.LOG);
105
				}
106
			}
107
108
			providerList.add(new CommandProvider());
109
			providerList.add(new ActionProvider());
110
			providerList.add(new WizardProvider());
111
			providerList.add(new PreferenceProvider());
112
			providers = (AbstractProvider[]) providerList
113
					.toArray(new AbstractProvider[providerList.size()]);
79
114
80
			providerMap = new HashMap();
115
			providerMap = new HashMap();
81
			for (int i = 0; i < providers.length; i++) {
116
			for (int i = 0; i < providers.length; i++) {
Lines 171-177 Link Here
171
		public String[] getMatchNames(Object element, Object parentElementOrNull) {
206
		public String[] getMatchNames(Object element, Object parentElementOrNull) {
172
			if (element instanceof AbstractProvider) {
207
			if (element instanceof AbstractProvider) {
173
				AbstractProvider provider = (AbstractProvider) element;
208
				AbstractProvider provider = (AbstractProvider) element;
174
				return (new String[]{provider.getName()});
209
				return (new String[] { provider.getName() });
175
			} else if (element instanceof AbstractElement) {
210
			} else if (element instanceof AbstractElement) {
176
				AbstractElement abstractElement = (AbstractElement) element;
211
				AbstractElement abstractElement = (AbstractElement) element;
177
				String sortLabel = abstractElement.getSortLabel();
212
				String sortLabel = abstractElement.getSortLabel();
Lines 181-201 Link Here
181
					String combinedLabel = abstractProvider.getName()
216
					String combinedLabel = abstractProvider.getName()
182
							+ " " + abstractElement.getLabel(); //$NON-NLS-1$
217
							+ " " + abstractElement.getLabel(); //$NON-NLS-1$
183
					String combinedCamelCase = getCamelCase(combinedLabel);
218
					String combinedCamelCase = getCamelCase(combinedLabel);
184
					return (new String[] { sortLabel, camelCase, combinedLabel, combinedCamelCase });
219
					return (new String[] { sortLabel, camelCase, combinedLabel,
220
							combinedCamelCase });
185
				}
221
				}
186
				return (new String[] { sortLabel, camelCase });
222
				return (new String[] { sortLabel, camelCase });
187
			}
223
			}
188
			return (new String[]{""}); //$NON-NLS-1$
224
			return (new String[] { "" }); //$NON-NLS-1$
189
		}
225
		}
190
		
226
191
		/**
227
		/**
192
		 * @return a string containing the first character of every word for
228
		 * @return a string containing the first character of every word for
193
		 * camel case checking.
229
		 *         camel case checking.
194
		 */
230
		 */
195
		private String getCamelCase(String label) {
231
		private String getCamelCase(String label) {
196
			StringTokenizer tokenizer = new StringTokenizer(label);
232
			StringTokenizer tokenizer = new StringTokenizer(label);
197
			StringBuffer camelCase = new StringBuffer();
233
			StringBuffer camelCase = new StringBuffer();
198
			while(tokenizer.hasMoreTokens()) {
234
			while (tokenizer.hasMoreTokens()) {
199
				String word = tokenizer.nextToken();
235
				String word = tokenizer.nextToken();
200
				camelCase.append(word.charAt(0));
236
				camelCase.append(word.charAt(0));
201
			}
237
			}
(-)META-INF/MANIFEST.MF (-1 / +1 lines)
Lines 38-44 Link Here
38
 org.eclipse.ui.internal.expressions;x-internal:=true,
38
 org.eclipse.ui.internal.expressions;x-internal:=true,
39
 org.eclipse.ui.internal.handlers;x-internal:=true,
39
 org.eclipse.ui.internal.handlers;x-internal:=true,
40
 org.eclipse.ui.internal.help;x-internal:=true,
40
 org.eclipse.ui.internal.help;x-internal:=true,
41
 org.eclipse.ui.internal.incubator;x-friends:="org.eclipse.ui",
41
 org.eclipse.ui.internal.incubator;x-friends:="org.eclipse.ui,org.eclipse.ui.ide",
42
 org.eclipse.ui.internal.intro;x-internal:=true,
42
 org.eclipse.ui.internal.intro;x-internal:=true,
43
 org.eclipse.ui.internal.keys;x-internal:=true,
43
 org.eclipse.ui.internal.keys;x-internal:=true,
44
 org.eclipse.ui.internal.layout;x-friends:="org.eclipse.ui.presentations.r21,org.eclipse.ui.intro",
44
 org.eclipse.ui.internal.layout;x-friends:="org.eclipse.ui.presentations.r21,org.eclipse.ui.intro",

Return to bug 167010