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 145556 Details for
Bug 284700
[IAD] Layout Extensions are read coincidentally
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
new Overriding behavior
layoutSetOverriding (text/plain), 13.55 KB, created by
Holger Staudacher
on 2009-08-25 11:43:42 EDT
(
hide
)
Description:
new Overriding behavior
Filename:
MIME Type:
Creator:
Holger Staudacher
Created:
2009-08-25 11:43:42 EDT
Size:
13.55 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.rap.ui.workbench >Index: Eclipse UI/org/eclipse/rap/ui/interactiondesign/layout/LayoutRegistry.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.ui/org.eclipse.rap.ui.workbench/Eclipse UI/org/eclipse/rap/ui/interactiondesign/layout/LayoutRegistry.java,v >retrieving revision 1.3 >diff -u -r1.3 LayoutRegistry.java >--- Eclipse UI/org/eclipse/rap/ui/interactiondesign/layout/LayoutRegistry.java 22 Jul 2009 10:52:44 -0000 1.3 >+++ Eclipse UI/org/eclipse/rap/ui/interactiondesign/layout/LayoutRegistry.java 25 Aug 2009 15:40:53 -0000 >@@ -51,6 +51,7 @@ > > private static Map layoutMap; > private static Map layoutSetToPluginId; >+ private static List overridenLayoutSets; > > static { > init(); >@@ -89,7 +90,7 @@ > > /** > * Sets the active <code>Layout</code> to the one, which belongs to the >- * id in the paramter and save the new id if necessary. >+ * id in the parameter and save the new id if necessary. > * > * @param id the new <code>Layout</code> id. > * @param save if <code>true</code> then the new <code>Layout</code> will be >@@ -121,34 +122,17 @@ > } > > /** >- * Returns the active <code>Layout</code>. If the active <code>Layout</code> >- * is not the default <code>Layout</code> then a hybrid <code>Layout</code> >- * is created. This contains the default <code>Layout</code> and the active >- * <code>Layout</code>. >- * <p> >- * This is necessary because a active layout can override >- * single <code>LayoutSet</code>s of a <code>Layout</code> but their can also >- * be <code>LayoutSet</code>s, which the active <code>Layout</code> doesn't >- * override. >- * </p> >+ * Returns the active <code>Layout</code>. > * >- * @return the active layout containing default <code>LayoutSet</code>s if the >- * active <code>Layout</code> doesn't override all default <code>LayoutSet >- * </code>s. >- * >- * @see LayoutSet >+ * @return the active layout > * @see Layout > */ > public Layout getActiveLayout() { > Layout result = activeLayout; >- if( activeLayoutId.equals( DEFAULT_LAYOUT_ID ) ) { >- if( result == null ) { >- result = ( Layout ) layoutMap.get( activeLayoutId ); >- activeLayout = result; >- } >- } else { >- result = createHybridLayout(); >- } >+ if( result == null ) { >+ result = ( Layout ) layoutMap.get( activeLayoutId ); >+ activeLayout = result; >+ } > return result; > } > >@@ -208,15 +192,14 @@ > > /** > * Initialize the <code>{@link LayoutSet}</code> contributed to the >- * <code>org.eclipse.rap.ui.layouts</code> extension point. >- * Additional it sets the active <code>Layout</code> to >- * <code>{#DEFAULT_LAYOUT_ID}</code>. >+ * <code>org.eclipse.rap.ui.layouts</code> extension point. > */ > private static void init() { > layoutSetToPluginId = new HashMap(); > layoutMap = new HashMap(); >+ overridenLayoutSets = new ArrayList(); > IConfigurationElement[] elements = getLayoutExtensions(); >- for( int i = elements.length - 1; i >= 0; i-- ) { >+ for( int i = 0; i < elements.length; i++ ) { > String id = elements[ i ].getAttribute( "id" ); > > Layout layout = ( Layout ) layoutMap.get( id ); >@@ -240,8 +223,9 @@ > return result; > } > >- private static void createLayoutSets( final IConfigurationElement[] layoutSets, >- final Layout layout ) >+ private static void createLayoutSets( >+ final IConfigurationElement[] layoutSets, >+ final Layout layout ) > { > if( layoutSets != null && layoutSets.length > 0 ) { > for( int i = 0; i < layoutSets.length; i++ ) { >@@ -249,55 +233,48 @@ > > String pluginId = layoutSetElement.getContributor().getName(); > String layoutSetId = layoutSetElement.getAttribute( "id" ); >- >- layout.clearLayoutSet( layoutSetId ); >- LayoutSet layoutSet = layout.getLayoutSet( layoutSetId ); >- layoutSetToPluginId.put( layoutSetId, pluginId ); >- >- try { >- Object initializer >- = layoutSetElement.createExecutableExtension( "class" ); >- if( initializer instanceof ILayoutSetInitializer ) { >- ILayoutSetInitializer layoutInitializer >- = ( ILayoutSetInitializer ) initializer; >- layoutInitializer.initializeLayoutSet( layoutSet ); >+ String overrides = layoutSetElement.getAttribute( "overrides" ); >+ if( overrides != null ) { >+ // clear the old layoutset if it exists and create it with the new >+ // contents. Addition create a new layoutset with the new id if >+ // someone want to override it again. >+ layout.clearLayoutSet( overrides ); >+ LayoutSet layoutSet = layout.getLayoutSet( overrides ); >+ layoutSetToPluginId.remove( overrides ); >+ layoutSetToPluginId.put( overrides, pluginId ); >+ initializeLayoutSet( layoutSetElement, layoutSet ); >+ LayoutSet overridingLayoutSet = layout.getLayoutSet( layoutSetId ); >+ layoutSetToPluginId.put( layoutSetId, pluginId ); >+ initializeLayoutSet( layoutSetElement, overridingLayoutSet ); >+ overridenLayoutSets.add( overrides ); >+ } else { >+ if( !overridenLayoutSets.contains( layoutSetId ) ) { >+ // a new layoutset will only created if it's not already overridden. >+ layout.clearLayoutSet( layoutSetId ); >+ LayoutSet layoutSet = layout.getLayoutSet( layoutSetId ); >+ layoutSetToPluginId.put( layoutSetId, pluginId ); >+ initializeLayoutSet( layoutSetElement, layoutSet ); > } >- } catch( CoreException e ) { >- e.printStackTrace(); > } > } > } > } > >- private void combineLayoutSets( final Layout layout, >- final Layout defaultLayout, >- final Layout activeLayout ) >+ private static void initializeLayoutSet( >+ final IConfigurationElement layoutSetElement, >+ final LayoutSet layoutSet ) > { >- if( defaultLayout != null ) { >- Map defaultLayoutSets = defaultLayout.getLayoutSets(); >- createLayoutSetFromLayout( layout, defaultLayoutSets ); >+ try { >+ Object initializer >+ = layoutSetElement.createExecutableExtension( "class" ); >+ if( initializer instanceof ILayoutSetInitializer ) { >+ ILayoutSetInitializer layoutInitializer >+ = ( ILayoutSetInitializer ) initializer; >+ layoutInitializer.initializeLayoutSet( layoutSet ); >+ } >+ } catch( CoreException e ) { >+ e.printStackTrace(); > } >- Map activeLayoutSets = activeLayout.getLayoutSets(); >- createLayoutSetFromLayout( layout, activeLayoutSets ); > } > >- private Layout createHybridLayout() { >- // TODO [hs] think about cache for hybrid Layouts >- Layout result = new Layout( activeLayoutId ); >- Layout defaultLayout = ( Layout )layoutMap.get( DEFAULT_LAYOUT_ID ); >- combineLayoutSets( result, defaultLayout, activeLayout ); >- return result; >- } >- >- private void createLayoutSetFromLayout( final Layout layout, >- final Map layoutSets ) >- { >- Object[] keys = layoutSets.keySet().toArray(); >- for( int i = 0; i < keys.length; i++ ) { >- String key = ( String )keys[ i ]; >- LayoutSet set = ( LayoutSet )layoutSets.get( key ); >- layout.clearLayoutSet( key ); >- layout.addLayoutSet( set ); >- } >- } > } >Index: Eclipse UI/org/eclipse/rap/ui/interactiondesign/layout/model/Layout.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.ui/org.eclipse.rap.ui.workbench/Eclipse UI/org/eclipse/rap/ui/interactiondesign/layout/model/Layout.java,v >retrieving revision 1.2 >diff -u -r1.2 Layout.java >--- Eclipse UI/org/eclipse/rap/ui/interactiondesign/layout/model/Layout.java 30 Jun 2009 20:24:10 -0000 1.2 >+++ Eclipse UI/org/eclipse/rap/ui/interactiondesign/layout/model/Layout.java 25 Aug 2009 15:40:53 -0000 >@@ -58,6 +58,7 @@ > LayoutSet set = ( LayoutSet ) layoutSets.get( layoutSetId ); > if( set != null ) { > layoutSets.remove( layoutSetId ); >+ set = null; > } > } > >#P org.eclipse.rap.ui >Index: schema/rap/layouts.exsd >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.ui/org.eclipse.rap.ui/schema/rap/layouts.exsd,v >retrieving revision 1.1 >diff -u -r1.1 layouts.exsd >--- schema/rap/layouts.exsd 24 Feb 2009 11:29:42 -0000 1.1 >+++ schema/rap/layouts.exsd 25 Aug 2009 15:40:59 -0000 >@@ -2,9 +2,9 @@ > <!-- Schema file written by PDE --> > <schema targetNamespace="org.eclipse.rap.ui" xmlns="http://www.w3.org/2001/XMLSchema"> > <annotation> >- <appinfo> >+ <appInfo> > <meta.schema plugin="org.eclipse.rap.ui" id="layouts" name="Layouts"/> >- </appinfo> >+ </appInfo> > <documentation> > This extension point is used to register a custom Layout. This means a grafical Layout not a Layout from the programmers point of view.<br> > Every Layout can hold attributes called LayoutSets. A LayoutSet is a simple container for images, fonts, colors and position data. These sets are usually coupled to a <code>ElementBuilder</code>.<br> >@@ -15,9 +15,9 @@ > > <element name="extension"> > <annotation> >- <appinfo> >+ <appInfo> > <meta.element /> >- </appinfo> >+ </appInfo> > </annotation> > <complexType> > <sequence> >@@ -42,9 +42,9 @@ > <documentation> > > </documentation> >- <appinfo> >+ <appInfo> > <meta.attribute translatable="true"/> >- </appinfo> >+ </appInfo> > </annotation> > </attribute> > </complexType> >@@ -71,9 +71,19 @@ > <documentation> > The definition of a LayoutSet. This is a class that has to implement the ILayoutSetInitializer interface. > </documentation> >- <appinfo> >+ <appInfo> > <meta.attribute kind="java" basedOn=":org.eclipse.rap.ui.interactiondesign.layout.model.ILayoutSetInitializer"/> >- </appinfo> >+ </appInfo> >+ </annotation> >+ </attribute> >+ <attribute name="overrides" type="string"> >+ <annotation> >+ <documentation> >+ To replace a layoutSet you can define a a new one and set the overrides attribute to make clear that the new layoutSet will replace the one defined in this attribute. >+ </documentation> >+ <appInfo> >+ <meta.attribute kind="identifier" basedOn="org.eclipse.rap.ui.layouts/layout/layoutSet/@id"/> >+ </appInfo> > </annotation> > </attribute> > </complexType> >@@ -102,18 +112,18 @@ > </element> > > <annotation> >- <appinfo> >+ <appInfo> > <meta.section type="since"/> >- </appinfo> >+ </appInfo> > <documentation> > RAP 1.2 > </documentation> > </annotation> > > <annotation> >- <appinfo> >+ <appInfo> > <meta.section type="examples"/> >- </appinfo> >+ </appInfo> > <documentation> > The following is an example of a Layout with three LayoutSets: > <p> >@@ -149,9 +159,9 @@ > </annotation> > > <annotation> >- <appinfo> >+ <appInfo> > <meta.section type="apiinfo"/> >- </appinfo> >+ </appInfo> > <documentation> > Each LayoutSet in a Layout has to implement the <code>ILayoutSetInitializer</code> interface. The method within is called during the plugin activation to initialize components like images or fonts for this LayoutSet. This implementation can look like this: > >@@ -170,18 +180,18 @@ > </annotation> > > <annotation> >- <appinfo> >+ <appInfo> > <meta.section type="implementation"/> >- </appinfo> >+ </appInfo> > <documentation> > A detailed implementation example can be found in the <code>org.eclipse.rap.presentation.example</code> project. This project defines two Layouts and a bunch of LayoutSets. They look not pretty but they do their job. > </documentation> > </annotation> > > <annotation> >- <appinfo> >+ <appInfo> > <meta.section type="copyright"/> >- </appinfo> >+ </appInfo> > <documentation> > Copyright (c) 2008 EclipseSource and others. All rights reserved. This > program and the accompanying materials are made available under the terms of >#P org.eclipse.rap.examples >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.ui/org.eclipse.rap.examples/plugin.xml,v >retrieving revision 1.6 >diff -u -r1.6 plugin.xml >--- plugin.xml 19 Aug 2009 14:59:18 -0000 1.6 >+++ plugin.xml 25 Aug 2009 15:41:07 -0000 >@@ -66,11 +66,12 @@ > point="org.eclipse.rap.ui.layouts"> > <layout > id="org.eclipse.rap.design.example.business.layout" >- name="Business Layout Blue"> >+ name="Business Layout Blue Extended"> > <layoutSet > class="org.eclipse.rap.examples.internal.design.LogoInitializer" >- id="org.eclipse.rap.design.example.business.layoutset.logo" >- name="Logo"> >+ id="org.eclipse.rap.design.example.business.layoutset.logo.extended" >+ name="Logo" >+ overrides="org.eclipse.rap.design.example.business.layoutset.logo"> > </layoutSet> > </layout> > </extension>
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 284700
: 145556