View | Details | Raw Unified | Return to bug 103045
Collapse All | Expand All

(-)Eclipse UI/org/eclipse/ui/IEditorDescriptor.java (+7 lines)
Lines 96-99 Link Here
96
     * @since 3.1
96
     * @since 3.1
97
     */
97
     */
98
    public IEditorMatchingStrategy getEditorMatchingStrategy();
98
    public IEditorMatchingStrategy getEditorMatchingStrategy();
99
    
100
    /**
101
     * Returns whether this editor allows multiple instances.
102
     * 
103
     * @return whether this editor allows multiple instances
104
     */
105
    public boolean getAllowMultiple();
99
}
106
}
(-)Eclipse UI/org/eclipse/ui/internal/registry/EditorDescriptor.java (-2 / +11 lines)
Lines 634-639 Link Here
634
        }
634
        }
635
        return matchingStrategy;
635
        return matchingStrategy;
636
    }
636
    }
637
    
637
638
    
638
    /* (non-Javadoc)
639
	 * @see org.eclipse.ui.IEditorDescriptor#getAllowMultiple()
640
	 */
641
	public boolean getAllowMultiple() {
642
		if (null == configurationElement) {
643
			return true;
644
		}
645
		String string = configurationElement.getAttribute(IWorkbenchRegistryConstants.ATT_ALLOW_MULTIPLE);    	
646
        return string == null ? true : Boolean.valueOf(string).booleanValue();
647
	}
639
}
648
}
(-)Eclipse (+48 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 ******************************************************************************/
11
12
package org.eclipse.ui.internal.handlers;
13
14
import org.eclipse.core.expressions.PropertyTester;
15
import org.eclipse.ui.IEditorDescriptor;
16
import org.eclipse.ui.IEditorPart;
17
import org.eclipse.ui.internal.WorkbenchPlugin;
18
import org.eclipse.ui.internal.registry.IWorkbenchRegistryConstants;
19
20
/**
21
 * Test to check various IEditorPart properties.
22
 * 
23
 */
24
public class EditorPartTester extends PropertyTester {
25
26
	/*
27
	 * (non-Javadoc)
28
	 * 
29
	 * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object,
30
	 * java.lang.String, java.lang.Object[], java.lang.Object)
31
	 */
32
	public boolean test(Object receiver, String property, Object[] args,
33
			Object expectedValue) {
34
		if (receiver instanceof IEditorPart) {
35
			IEditorDescriptor editorDescriptor = WorkbenchPlugin.getDefault().getEditorRegistry().findEditor(((IEditorPart)receiver).getSite().getId());
36
			if (null != editorDescriptor) {
37
				if (IWorkbenchRegistryConstants.ATT_ALLOW_MULTIPLE.equals(property)) {
38
					if (expectedValue instanceof Boolean) {
39
						return editorDescriptor.getAllowMultiple() == ((Boolean)expectedValue).booleanValue();
40
					}
41
					return editorDescriptor.getAllowMultiple();
42
				}
43
			}
44
		}
45
		return false;
46
	}
47
48
}
(-)plugin.xml (-3 / +16 lines)
Lines 2002-2010 Link Here
2002
         <enabledWhen>
2002
         <enabledWhen>
2003
            <with
2003
            <with
2004
                  variable="activeEditor">
2004
                  variable="activeEditor">
2005
               <instanceof
2005
               <and>
2006
                     value="org.eclipse.ui.IEditorPart">
2006
                  <instanceof
2007
               </instanceof>
2007
                        value="org.eclipse.ui.IEditorPart">
2008
                  </instanceof>
2009
                  <test
2010
                        property="org.eclipse.ui.editors.allowMultiple"
2011
                        value="true">
2012
                  </test>
2013
               </and>
2008
            </with>
2014
            </with>
2009
         </enabledWhen>
2015
         </enabledWhen>
2010
      </handler>
2016
      </handler>
Lines 2214-2219 Link Here
2214
            properties="reuseEditor"
2220
            properties="reuseEditor"
2215
            type="java.lang.Object">
2221
            type="java.lang.Object">
2216
      </propertyTester>
2222
      </propertyTester>
2223
      <propertyTester
2224
            class="org.eclipse.ui.internal.handlers.EditorPartTester"
2225
            id="org.eclipse.ui.editors.EditorPartTester"
2226
            namespace="org.eclipse.ui.editors"
2227
            properties="allowMultiple"
2228
            type="org.eclipse.ui.IEditorPart">
2229
      </propertyTester>
2217
   </extension>
2230
   </extension>
2218
   <extension
2231
   <extension
2219
         point="org.eclipse.ui.installationPages">
2232
         point="org.eclipse.ui.installationPages">
(-)schema/editors.exsd (-32 / +39 lines)
Lines 2-10 Link Here
2
<!-- Schema file written by PDE -->
2
<!-- Schema file written by PDE -->
3
<schema targetNamespace="org.eclipse.ui" xmlns="http://www.w3.org/2001/XMLSchema">
3
<schema targetNamespace="org.eclipse.ui" xmlns="http://www.w3.org/2001/XMLSchema">
4
<annotation>
4
<annotation>
5
      <appinfo>
5
      <appInfo>
6
         <meta.schema plugin="org.eclipse.ui" id="editors" name="Internal and External Editors"/>
6
         <meta.schema plugin="org.eclipse.ui" id="editors" name="Internal and External Editors"/>
7
      </appinfo>
7
      </appInfo>
8
      <documentation>
8
      <documentation>
9
         This extension point is used to add new editors to the 
9
         This extension point is used to add new editors to the 
10
workbench.  A editor is a visual component within a 
10
workbench.  A editor is a visual component within a 
Lines 42-50 Link Here
42
42
43
   <element name="extension">
43
   <element name="extension">
44
      <annotation>
44
      <annotation>
45
         <appinfo>
45
         <appInfo>
46
            <meta.element />
46
            <meta.element />
47
         </appinfo>
47
         </appInfo>
48
      </annotation>
48
      </annotation>
49
      <complexType>
49
      <complexType>
50
         <sequence>
50
         <sequence>
Lines 69-77 Link Here
69
               <documentation>
69
               <documentation>
70
                  an optional name of the extension instance
70
                  an optional name of the extension instance
71
               </documentation>
71
               </documentation>
72
               <appinfo>
72
               <appInfo>
73
                  <meta.attribute translatable="true"/>
73
                  <meta.attribute translatable="true"/>
74
               </appinfo>
74
               </appInfo>
75
            </annotation>
75
            </annotation>
76
         </attribute>
76
         </attribute>
77
      </complexType>
77
      </complexType>
Lines 79-87 Link Here
79
79
80
   <element name="editor">
80
   <element name="editor">
81
      <annotation>
81
      <annotation>
82
         <appinfo>
82
         <appInfo>
83
            <meta.element labelAttribute="name" icon="icon"/>
83
            <meta.element labelAttribute="name" icon="icon"/>
84
         </appinfo>
84
         </appInfo>
85
      </annotation>
85
      </annotation>
86
      <complexType>
86
      <complexType>
87
         <sequence>
87
         <sequence>
Lines 99-107 Link Here
99
               <documentation>
99
               <documentation>
100
                  a translatable name that will be used in the UI for this editor
100
                  a translatable name that will be used in the UI for this editor
101
               </documentation>
101
               </documentation>
102
               <appinfo>
102
               <appInfo>
103
                  <meta.attribute translatable="true"/>
103
                  <meta.attribute translatable="true"/>
104
               </appinfo>
104
               </appInfo>
105
            </annotation>
105
            </annotation>
106
         </attribute>
106
         </attribute>
107
         <attribute name="icon" type="string">
107
         <attribute name="icon" type="string">
Lines 110-118 Link Here
110
                  A relative name of the icon that will be used for all resources that match the specified extensions. Editors should provide an icon to make it easy for users to distinguish between different editor types. If you specify a command rather than a class, an icon is not needed. In that case, the workbench 
110
                  A relative name of the icon that will be used for all resources that match the specified extensions. Editors should provide an icon to make it easy for users to distinguish between different editor types. If you specify a command rather than a class, an icon is not needed. In that case, the workbench 
111
will use the icon provided by the operating system.
111
will use the icon provided by the operating system.
112
               </documentation>
112
               </documentation>
113
               <appinfo>
113
               <appInfo>
114
                  <meta.attribute kind="resource"/>
114
                  <meta.attribute kind="resource"/>
115
               </appinfo>
115
               </appInfo>
116
            </annotation>
116
            </annotation>
117
         </attribute>
117
         </attribute>
118
         <attribute name="extensions" type="string">
118
         <attribute name="extensions" type="string">
Lines 127-135 Link Here
127
               <documentation>
127
               <documentation>
128
                  the name of a class that implements &lt;samp&gt;org.eclipse.ui.IEditorPart&lt;/samp&gt;. The attributes &lt;samp&gt;class&lt;/samp&gt;, &lt;samp&gt;command&lt;/samp&gt;, and &lt;samp&gt;launcher&lt;/samp&gt; are mutually exclusive. If this attribute is defined then &lt;samp&gt;contributorClass&lt;/samp&gt; should also be defined.
128
                  the name of a class that implements &lt;samp&gt;org.eclipse.ui.IEditorPart&lt;/samp&gt;. The attributes &lt;samp&gt;class&lt;/samp&gt;, &lt;samp&gt;command&lt;/samp&gt;, and &lt;samp&gt;launcher&lt;/samp&gt; are mutually exclusive. If this attribute is defined then &lt;samp&gt;contributorClass&lt;/samp&gt; should also be defined.
129
               </documentation>
129
               </documentation>
130
               <appinfo>
130
               <appInfo>
131
                  <meta.attribute kind="java" basedOn="org.eclipse.ui.part.EditorPart"/>
131
                  <meta.attribute kind="java" basedOn="org.eclipse.ui.part.EditorPart"/>
132
               </appinfo>
132
               </appInfo>
133
            </annotation>
133
            </annotation>
134
         </attribute>
134
         </attribute>
135
         <attribute name="command" type="string">
135
         <attribute name="command" type="string">
Lines 145-153 Link Here
145
                  the name of a class which that implements &lt;samp&gt;org.eclipse.ui.IEditorLauncher&lt;/samp&gt;. 
145
                  the name of a class which that implements &lt;samp&gt;org.eclipse.ui.IEditorLauncher&lt;/samp&gt;. 
146
A launcher will open an external editor. The attributes &lt;samp&gt;class&lt;/samp&gt;, &lt;samp&gt;command&lt;/samp&gt;, and &lt;samp&gt;launcher&lt;/samp&gt; are mutually exclusive.
146
A launcher will open an external editor. The attributes &lt;samp&gt;class&lt;/samp&gt;, &lt;samp&gt;command&lt;/samp&gt;, and &lt;samp&gt;launcher&lt;/samp&gt; are mutually exclusive.
147
               </documentation>
147
               </documentation>
148
               <appinfo>
148
               <appInfo>
149
                  <meta.attribute kind="java" basedOn="org.eclipse.ui.IEditorLauncher"/>
149
                  <meta.attribute kind="java" basedOn="org.eclipse.ui.IEditorLauncher"/>
150
               </appinfo>
150
               </appInfo>
151
            </annotation>
151
            </annotation>
152
         </attribute>
152
         </attribute>
153
         <attribute name="contributorClass" type="string">
153
         <attribute name="contributorClass" type="string">
Lines 155-163 Link Here
155
               <documentation>
155
               <documentation>
156
                  the name of a class that implements &lt;samp&gt;org.eclipse.ui.IEditorActionBarContributor&lt;/samp&gt;. This attribute should only be defined if the &lt;samp&gt;class&lt;/samp&gt; attribute is defined. This class is used to add new actions to the workbench menu and tool bar which reflect the features of the editor type.
156
                  the name of a class that implements &lt;samp&gt;org.eclipse.ui.IEditorActionBarContributor&lt;/samp&gt;. This attribute should only be defined if the &lt;samp&gt;class&lt;/samp&gt; attribute is defined. This class is used to add new actions to the workbench menu and tool bar which reflect the features of the editor type.
157
               </documentation>
157
               </documentation>
158
               <appinfo>
158
               <appInfo>
159
                  <meta.attribute kind="java" basedOn="org.eclipse.ui.part.EditorActionBarContributor"/>
159
                  <meta.attribute kind="java" basedOn="org.eclipse.ui.part.EditorActionBarContributor"/>
160
               </appinfo>
160
               </appInfo>
161
            </annotation>
161
            </annotation>
162
         </attribute>
162
         </attribute>
163
         <attribute name="default" type="boolean" use="default" value="false">
163
         <attribute name="default" type="boolean" use="default" value="false">
Lines 196-204 Link Here
196
               <documentation>
196
               <documentation>
197
                  the name of a class that implements &lt;samp&gt;org.eclipse.ui.IEditorMatchingStrategy&lt;/samp&gt;. This attribute should only be defined if the &lt;samp&gt;class&lt;/samp&gt; attribute is defined. This allows the editor extension to provide its own algorithm for matching the input of one of its editors to a given editor input.
197
                  the name of a class that implements &lt;samp&gt;org.eclipse.ui.IEditorMatchingStrategy&lt;/samp&gt;. This attribute should only be defined if the &lt;samp&gt;class&lt;/samp&gt; attribute is defined. This allows the editor extension to provide its own algorithm for matching the input of one of its editors to a given editor input.
198
               </documentation>
198
               </documentation>
199
               <appinfo>
199
               <appInfo>
200
                  <meta.attribute kind="java" basedOn="org.eclipse.ui.IEditorMatchingStrategy"/>
200
                  <meta.attribute kind="java" basedOn="org.eclipse.ui.IEditorMatchingStrategy"/>
201
               </appinfo>
201
               </appInfo>
202
            </annotation>
203
         </attribute>
204
         <attribute name="allowMultiple" type="boolean">
205
            <annotation>
206
               <documentation>
207
                  flag indicating whether this editor allows multiple instances to be created using the &quot;New Editor&quot; right click menu of the editors tab. The default is true.
208
               </documentation>
202
            </annotation>
209
            </annotation>
203
         </attribute>
210
         </attribute>
204
      </complexType>
211
      </complexType>
Lines 206-214 Link Here
206
213
207
   <element name="contentTypeBinding">
214
   <element name="contentTypeBinding">
208
      <annotation>
215
      <annotation>
209
         <appinfo>
216
         <appInfo>
210
            <meta.element labelAttribute="contentTypeId"/>
217
            <meta.element labelAttribute="contentTypeId"/>
211
         </appinfo>
218
         </appInfo>
212
         <documentation>
219
         <documentation>
213
            Advertises that the containing editor understands the given content type and is suitable for editing files of that type.
220
            Advertises that the containing editor understands the given content type and is suitable for editing files of that type.
214
         </documentation>
221
         </documentation>
Lines 219-236 Link Here
219
               <documentation>
226
               <documentation>
220
                  The content type identifier. This is an ID defined by the &apos;org.eclipse.core.contenttype.contentTypes&apos; extension point.
227
                  The content type identifier. This is an ID defined by the &apos;org.eclipse.core.contenttype.contentTypes&apos; extension point.
221
               </documentation>
228
               </documentation>
222
               <appinfo>
229
               <appInfo>
223
                  <meta.attribute kind="identifier" basedOn="org.eclipse.core.contenttype.contentTypes/content-type/@id"/>
230
                  <meta.attribute kind="identifier" basedOn="org.eclipse.core.contenttype.contentTypes/content-type/@id"/>
224
               </appinfo>
231
               </appInfo>
225
            </annotation>
232
            </annotation>
226
         </attribute>
233
         </attribute>
227
      </complexType>
234
      </complexType>
228
   </element>
235
   </element>
229
236
230
   <annotation>
237
   <annotation>
231
      <appinfo>
238
      <appInfo>
232
         <meta.section type="examples"/>
239
         <meta.section type="examples"/>
233
      </appinfo>
240
      </appInfo>
234
      <documentation>
241
      <documentation>
235
         The following is an example 
242
         The following is an example 
236
of an internal editor extension definition: 
243
of an internal editor extension definition: 
Lines 254-262 Link Here
254
   </annotation>
261
   </annotation>
255
262
256
   <annotation>
263
   <annotation>
257
      <appinfo>
264
      <appInfo>
258
         <meta.section type="apiInfo"/>
265
         <meta.section type="apiInfo"/>
259
      </appinfo>
266
      </appInfo>
260
      <documentation>
267
      <documentation>
261
         If the command attribute is used, it will be treated 
268
         If the command attribute is used, it will be treated 
262
as an external program command line that will be executed
269
as an external program command line that will be executed
Lines 320-337 Link Here
320
327
321
328
322
   <annotation>
329
   <annotation>
323
      <appinfo>
330
      <appInfo>
324
         <meta.section type="implementation"/>
331
         <meta.section type="implementation"/>
325
      </appinfo>
332
      </appInfo>
326
      <documentation>
333
      <documentation>
327
         The workbench provides a &quot;Default Text Editor&quot;. The end user product may contain other editors as part of the shipping bundle. In that case, editors will be registered as extensions using the syntax described above.
334
         The workbench provides a &quot;Default Text Editor&quot;. The end user product may contain other editors as part of the shipping bundle. In that case, editors will be registered as extensions using the syntax described above.
328
      </documentation>
335
      </documentation>
329
   </annotation>
336
   </annotation>
330
337
331
   <annotation>
338
   <annotation>
332
      <appinfo>
339
      <appInfo>
333
         <meta.section type="copyright"/>
340
         <meta.section type="copyright"/>
334
      </appinfo>
341
      </appInfo>
335
      <documentation>
342
      <documentation>
336
         Copyright (c) 2002, 2007 IBM Corporation and others.&lt;br&gt;
343
         Copyright (c) 2002, 2007 IBM Corporation and others.&lt;br&gt;
337
All rights reserved. This program and the accompanying materials are made
344
All rights reserved. This program and the accompanying materials are made

Return to bug 103045