### Eclipse Workspace Patch 1.0 #P org.eclipse.ui.workbench Index: Eclipse UI/org/eclipse/ui/IEditorDescriptor.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorDescriptor.java,v retrieving revision 1.12 diff -u -r1.12 IEditorDescriptor.java --- Eclipse UI/org/eclipse/ui/IEditorDescriptor.java 9 May 2008 14:13:12 -0000 1.12 +++ Eclipse UI/org/eclipse/ui/IEditorDescriptor.java 26 Mar 2009 00:45:53 -0000 @@ -96,4 +96,11 @@ * @since 3.1 */ public IEditorMatchingStrategy getEditorMatchingStrategy(); + + /** + * Returns whether this editor allows multiple instances. + * + * @return whether this editor allows multiple instances + */ + public boolean getAllowMultiple(); } Index: Eclipse UI/org/eclipse/ui/internal/registry/EditorDescriptor.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/EditorDescriptor.java,v retrieving revision 1.44 diff -u -r1.44 EditorDescriptor.java --- Eclipse UI/org/eclipse/ui/internal/registry/EditorDescriptor.java 8 Mar 2009 16:49:53 -0000 1.44 +++ Eclipse UI/org/eclipse/ui/internal/registry/EditorDescriptor.java 26 Mar 2009 00:45:54 -0000 @@ -634,6 +634,15 @@ } return matchingStrategy; } - - + + /* (non-Javadoc) + * @see org.eclipse.ui.IEditorDescriptor#getAllowMultiple() + */ + public boolean getAllowMultiple() { + if (null == configurationElement) { + return true; + } + String string = configurationElement.getAttribute(IWorkbenchRegistryConstants.ATT_ALLOW_MULTIPLE); + return string == null ? true : Boolean.valueOf(string).booleanValue(); + } } Index: Eclipse UI/org/eclipse/ui/internal/handlers/EditorPartTester.java =================================================================== RCS file: Eclipse UI/org/eclipse/ui/internal/handlers/EditorPartTester.java diff -N Eclipse UI/org/eclipse/ui/internal/handlers/EditorPartTester.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ Eclipse UI/org/eclipse/ui/internal/handlers/EditorPartTester.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,48 @@ +/******************************************************************************* + * Copyright (c) 2009 IBM Corporation and others. + * 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: + * IBM Corporation - initial API and implementation + ******************************************************************************/ + +package org.eclipse.ui.internal.handlers; + +import org.eclipse.core.expressions.PropertyTester; +import org.eclipse.ui.IEditorDescriptor; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.internal.WorkbenchPlugin; +import org.eclipse.ui.internal.registry.IWorkbenchRegistryConstants; + +/** + * Test to check various IEditorPart properties. + * + */ +public class EditorPartTester extends PropertyTester { + + /* + * (non-Javadoc) + * + * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, + * java.lang.String, java.lang.Object[], java.lang.Object) + */ + public boolean test(Object receiver, String property, Object[] args, + Object expectedValue) { + if (receiver instanceof IEditorPart) { + IEditorDescriptor editorDescriptor = WorkbenchPlugin.getDefault().getEditorRegistry().findEditor(((IEditorPart)receiver).getSite().getId()); + if (null != editorDescriptor) { + if (IWorkbenchRegistryConstants.ATT_ALLOW_MULTIPLE.equals(property)) { + if (expectedValue instanceof Boolean) { + return editorDescriptor.getAllowMultiple() == ((Boolean)expectedValue).booleanValue(); + } + return editorDescriptor.getAllowMultiple(); + } + } + } + return false; + } + +} #P org.eclipse.ui Index: plugin.xml =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.ui/plugin.xml,v retrieving revision 1.441 diff -u -r1.441 plugin.xml --- plugin.xml 25 Feb 2009 15:03:51 -0000 1.441 +++ plugin.xml 26 Mar 2009 00:46:13 -0000 @@ -2002,9 +2002,15 @@ - - + + + + + + @@ -2214,6 +2220,13 @@ properties="reuseEditor" type="java.lang.Object"> + + Index: schema/editors.exsd =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.ui/schema/editors.exsd,v retrieving revision 1.19 diff -u -r1.19 editors.exsd --- schema/editors.exsd 15 Oct 2008 16:08:34 -0000 1.19 +++ schema/editors.exsd 26 Mar 2009 00:46:18 -0000 @@ -2,9 +2,9 @@ - + - + This extension point is used to add new editors to the workbench. A editor is a visual component within a @@ -42,9 +42,9 @@ - + - + @@ -69,9 +69,9 @@ an optional name of the extension instance - + - + @@ -79,9 +79,9 @@ - + - + @@ -99,9 +99,9 @@ a translatable name that will be used in the UI for this editor - + - + @@ -110,9 +110,9 @@ 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 will use the icon provided by the operating system. - + - + @@ -127,9 +127,9 @@ the name of a class that implements <samp>org.eclipse.ui.IEditorPart</samp>. The attributes <samp>class</samp>, <samp>command</samp>, and <samp>launcher</samp> are mutually exclusive. If this attribute is defined then <samp>contributorClass</samp> should also be defined. - + - + @@ -145,9 +145,9 @@ the name of a class which that implements <samp>org.eclipse.ui.IEditorLauncher</samp>. A launcher will open an external editor. The attributes <samp>class</samp>, <samp>command</samp>, and <samp>launcher</samp> are mutually exclusive. - + - + @@ -155,9 +155,9 @@ the name of a class that implements <samp>org.eclipse.ui.IEditorActionBarContributor</samp>. This attribute should only be defined if the <samp>class</samp> 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. - + - + @@ -196,9 +196,16 @@ the name of a class that implements <samp>org.eclipse.ui.IEditorMatchingStrategy</samp>. This attribute should only be defined if the <samp>class</samp> 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. - + - + + + + + + + flag indicating whether this editor allows multiple instances to be created using the "New Editor" right click menu of the editors tab. The default is true. + @@ -206,9 +213,9 @@ - + - + Advertises that the containing editor understands the given content type and is suitable for editing files of that type. @@ -219,18 +226,18 @@ The content type identifier. This is an ID defined by the 'org.eclipse.core.contenttype.contentTypes' extension point. - + - + - + - + The following is an example of an internal editor extension definition: @@ -254,9 +261,9 @@ - + - + If the command attribute is used, it will be treated as an external program command line that will be executed @@ -320,18 +327,18 @@ - + - + The workbench provides a "Default Text Editor". 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. - + - + Copyright (c) 2002, 2007 IBM Corporation and others.<br> All rights reserved. This program and the accompanying materials are made