Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 129911 Details for
Bug 103045
[EditorMgmt] [RCP] Need way to disable "New Editor" action
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Initial patch
patch.txt (text/plain), 13.85 KB, created by
Philipp Kursawe
on 2009-03-25 20:47:15 EDT
(
hide
)
Description:
Initial patch
Filename:
MIME Type:
Creator:
Philipp Kursawe
Created:
2009-03-25 20:47:15 EDT
Size:
13.85 KB
patch
obsolete
>### 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 @@ > <enabledWhen> > <with > variable="activeEditor"> >- <instanceof >- value="org.eclipse.ui.IEditorPart"> >- </instanceof> >+ <and> >+ <instanceof >+ value="org.eclipse.ui.IEditorPart"> >+ </instanceof> >+ <test >+ property="org.eclipse.ui.editors.allowMultiple" >+ value="true"> >+ </test> >+ </and> > </with> > </enabledWhen> > </handler> >@@ -2214,6 +2220,13 @@ > properties="reuseEditor" > type="java.lang.Object"> > </propertyTester> >+ <propertyTester >+ class="org.eclipse.ui.internal.handlers.EditorPartTester" >+ id="org.eclipse.ui.editors.EditorPartTester" >+ namespace="org.eclipse.ui.editors" >+ properties="allowMultiple" >+ type="org.eclipse.ui.IEditorPart"> >+ </propertyTester> > </extension> > <extension > point="org.eclipse.ui.installationPages"> >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 @@ > <!-- Schema file written by PDE --> > <schema targetNamespace="org.eclipse.ui" xmlns="http://www.w3.org/2001/XMLSchema"> > <annotation> >- <appinfo> >+ <appInfo> > <meta.schema plugin="org.eclipse.ui" id="editors" name="Internal and External Editors"/> >- </appinfo> >+ </appInfo> > <documentation> > This extension point is used to add new editors to the > workbench. A editor is a visual component within a >@@ -42,9 +42,9 @@ > > <element name="extension"> > <annotation> >- <appinfo> >+ <appInfo> > <meta.element /> >- </appinfo> >+ </appInfo> > </annotation> > <complexType> > <sequence> >@@ -69,9 +69,9 @@ > <documentation> > an optional name of the extension instance > </documentation> >- <appinfo> >+ <appInfo> > <meta.attribute translatable="true"/> >- </appinfo> >+ </appInfo> > </annotation> > </attribute> > </complexType> >@@ -79,9 +79,9 @@ > > <element name="editor"> > <annotation> >- <appinfo> >+ <appInfo> > <meta.element labelAttribute="name" icon="icon"/> >- </appinfo> >+ </appInfo> > </annotation> > <complexType> > <sequence> >@@ -99,9 +99,9 @@ > <documentation> > a translatable name that will be used in the UI for this editor > </documentation> >- <appinfo> >+ <appInfo> > <meta.attribute translatable="true"/> >- </appinfo> >+ </appInfo> > </annotation> > </attribute> > <attribute name="icon" type="string"> >@@ -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. > </documentation> >- <appinfo> >+ <appInfo> > <meta.attribute kind="resource"/> >- </appinfo> >+ </appInfo> > </annotation> > </attribute> > <attribute name="extensions" type="string"> >@@ -127,9 +127,9 @@ > <documentation> > 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. > </documentation> >- <appinfo> >+ <appInfo> > <meta.attribute kind="java" basedOn="org.eclipse.ui.part.EditorPart"/> >- </appinfo> >+ </appInfo> > </annotation> > </attribute> > <attribute name="command" type="string"> >@@ -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. > </documentation> >- <appinfo> >+ <appInfo> > <meta.attribute kind="java" basedOn="org.eclipse.ui.IEditorLauncher"/> >- </appinfo> >+ </appInfo> > </annotation> > </attribute> > <attribute name="contributorClass" type="string"> >@@ -155,9 +155,9 @@ > <documentation> > 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. > </documentation> >- <appinfo> >+ <appInfo> > <meta.attribute kind="java" basedOn="org.eclipse.ui.part.EditorActionBarContributor"/> >- </appinfo> >+ </appInfo> > </annotation> > </attribute> > <attribute name="default" type="boolean" use="default" value="false"> >@@ -196,9 +196,16 @@ > <documentation> > 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. > </documentation> >- <appinfo> >+ <appInfo> > <meta.attribute kind="java" basedOn="org.eclipse.ui.IEditorMatchingStrategy"/> >- </appinfo> >+ </appInfo> >+ </annotation> >+ </attribute> >+ <attribute name="allowMultiple" type="boolean"> >+ <annotation> >+ <documentation> >+ 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. >+ </documentation> > </annotation> > </attribute> > </complexType> >@@ -206,9 +213,9 @@ > > <element name="contentTypeBinding"> > <annotation> >- <appinfo> >+ <appInfo> > <meta.element labelAttribute="contentTypeId"/> >- </appinfo> >+ </appInfo> > <documentation> > Advertises that the containing editor understands the given content type and is suitable for editing files of that type. > </documentation> >@@ -219,18 +226,18 @@ > <documentation> > The content type identifier. This is an ID defined by the 'org.eclipse.core.contenttype.contentTypes' extension point. > </documentation> >- <appinfo> >+ <appInfo> > <meta.attribute kind="identifier" basedOn="org.eclipse.core.contenttype.contentTypes/content-type/@id"/> >- </appinfo> >+ </appInfo> > </annotation> > </attribute> > </complexType> > </element> > > <annotation> >- <appinfo> >+ <appInfo> > <meta.section type="examples"/> >- </appinfo> >+ </appInfo> > <documentation> > The following is an example > of an internal editor extension definition: >@@ -254,9 +261,9 @@ > </annotation> > > <annotation> >- <appinfo> >+ <appInfo> > <meta.section type="apiInfo"/> >- </appinfo> >+ </appInfo> > <documentation> > If the command attribute is used, it will be treated > as an external program command line that will be executed >@@ -320,18 +327,18 @@ > > > <annotation> >- <appinfo> >+ <appInfo> > <meta.section type="implementation"/> >- </appinfo> >+ </appInfo> > <documentation> > 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. > </documentation> > </annotation> > > <annotation> >- <appinfo> >+ <appInfo> > <meta.section type="copyright"/> >- </appinfo> >+ </appInfo> > <documentation> > Copyright (c) 2002, 2007 IBM Corporation and others.<br> > All rights reserved. This program and the accompanying materials are made
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 103045
: 129911 |
129912