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 146933 Details for
Bug 279613
Move RAP-specific classes to RAP namespace
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]
patch
clipboard.txt (text/plain), 116.50 KB, created by
Benjamin Muskalla
on 2009-09-11 04:33:20 EDT
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Benjamin Muskalla
Created:
2009-09-11 04:33:20 EDT
Size:
116.50 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.rap.ui >Index: schema/rap/settingstores.exsd >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.ui/org.eclipse.rap.ui/schema/rap/settingstores.exsd,v >retrieving revision 1.1 >diff -u -r1.1 settingstores.exsd >--- schema/rap/settingstores.exsd 18 Apr 2008 10:46:45 -0000 1.1 >+++ schema/rap/settingstores.exsd 11 Sep 2009 08:35:38 -0000 >@@ -111,7 +111,7 @@ > <extension > point="org.eclipse.rap.ui.settingstores"> > <factory >- class="org.eclipse.ui.internal.preferences.WorkbenchFileSettingStoreFactory" >+ class="org.eclipse.rap.ui.internal.preferences.WorkbenchFileSettingStoreFactory" > id="file"> > </factory> > <factory >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.ui/org.eclipse.rap.ui/plugin.xml,v >retrieving revision 1.21 >diff -u -r1.21 plugin.xml >--- plugin.xml 10 Sep 2009 10:56:00 -0000 1.21 >+++ plugin.xml 11 Sep 2009 08:35:38 -0000 >@@ -2244,6 +2244,6 @@ > <extension id="preferences" > point="org.eclipse.core.runtime.preferences"> > <scope name="session" >- class="org.eclipse.ui.internal.preferences.SessionPreferencesFactory"/> >+ class="org.eclipse.rap.ui.internal.preferences.SessionPreferencesFactory"/> > </extension> > </plugin> >#P org.eclipse.rap.ui.workbench >Index: Eclipse UI/org/eclipse/ui/internal/preferences/SessionPreferenceNodeCore.java >=================================================================== >RCS file: Eclipse UI/org/eclipse/ui/internal/preferences/SessionPreferenceNodeCore.java >diff -N Eclipse UI/org/eclipse/ui/internal/preferences/SessionPreferenceNodeCore.java >--- Eclipse UI/org/eclipse/ui/internal/preferences/SessionPreferenceNodeCore.java 13 Jun 2008 06:31:16 -0000 1.4 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,183 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2008 Innoopract Informationssysteme GmbH. >- * 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >-package org.eclipse.ui.internal.preferences; >- >-import org.eclipse.core.runtime.*; >-import org.eclipse.core.runtime.preferences.IEclipsePreferences.*; >-import org.eclipse.rwt.RWT; >-import org.eclipse.rwt.internal.util.ParamCheck; >-import org.eclipse.rwt.service.*; >-import org.eclipse.ui.internal.WorkbenchPlugin; >-import org.osgi.service.prefs.Preferences; >- >-/** >- * This class is the link between the SessionPreferenceNode hierarchy >- * (application global) the RWT setting store (session specific). >- */ >-final class SessionPreferenceNodeCore { >- >- private final SessionPreferencesNode node; >- private ListenerList prefListeners; // ListenerList is thread safe >- private final ListenerList nodeListeners >- = new ListenerList( ListenerList.IDENTITY ); // thread safe >- >- >- /* tracks changes in RWT setting store and notifies the prefListeners */ >- private SettingStoreListener rwtListener; >- /* true to track RWT changes */ >- private boolean trackChanges = true; >- /* ignore changes to this key for a short time */ >- private String ignoreKey; >- >- SessionPreferenceNodeCore( final SessionPreferencesNode node ) { >- ParamCheck.notNull( node, "node" ); //$NON-NLS-1$ >- this.node = node; >- } >- >- void addPreferenceChangeListener( IPreferenceChangeListener listener ) { >- if( listener != null ) { >- getListenerList().add( listener ); >- setTrackRWTChanges( true ); >- } >- } >- >- void removePreferenceChangeListener( IPreferenceChangeListener listener ) { >- if( listener != null ) { >- ListenerList list = getListenerList(); >- list.remove( listener ); >- if( list.isEmpty() ) { >- setTrackRWTChanges( false ); >- } >- } >- } >- >- void firePreferenceEvent( final String key, >- final String oldValue, >- final String newValue ) >- { >- if( prefListeners != null ) { >- final PreferenceChangeEvent event >- = new PreferenceChangeEvent( node, key, oldValue, newValue ); >- Object[] listeners = prefListeners.getListeners(); >- for( int i = 0; i < listeners.length; i++ ) { >- final IPreferenceChangeListener listener >- = ( IPreferenceChangeListener )listeners[ i ]; >- ISafeRunnable op = new ISafeRunnable() { >- public void handleException( final Throwable exception ) { >- // logged by SafeRunner >- } >- public void run() throws Exception { >- listener.preferenceChange( event ); >- } >- }; >- SafeRunner.run( op ); >- } >- } >- } >- >- void clear() { >- if( prefListeners != null ) { >- prefListeners.clear(); >- prefListeners = null; >- setTrackRWTChanges( false ); >- } >- nodeListeners.clear(); >- } >- >- synchronized String put( final String uniqueKey, >- final String value ) { >- ISettingStore store = RWT.getSettingStore(); >- String result = store.getAttribute( uniqueKey ); >- try { >- ignoreKey = uniqueKey; >- store.setAttribute( uniqueKey, value ); >- ignoreKey = null; >- } catch( SettingStoreException exc ) { >- String msg = "Could not persist preference: " + uniqueKey; //$NON-NLS-1$ >- WorkbenchPlugin.log( msg, exc ); >- } >- return result; >- } >- >- // helping methods >- ////////////////// >- >- private synchronized ListenerList getListenerList() { >- if( prefListeners == null ) { >- prefListeners = new ListenerList( ListenerList.IDENTITY ); >- } >- return prefListeners; >- } >- >- private synchronized void setTrackRWTChanges( final boolean doTrack ) { >- this.trackChanges = doTrack; >- if( trackChanges ) { >- if( rwtListener == null ) { >- rwtListener = new SettingStoreListener() { >- public void settingChanged( SettingStoreEvent event ) { >- if( trackChanges ) { >- String fullKey = event.getAttributeName(); >- if( !fullKey.equals( ignoreKey ) ) { >- String absPath = node.absolutePath(); >- if( fullKey.startsWith( absPath ) ) { >- String key = fullKey.substring( absPath.length() + 1 ); >- String oldValue = event.getOldValue(); >- String newValue = event.getNewValue(); >- firePreferenceEvent( key, oldValue, newValue ); >- } >- } >- } >- } >- }; >- } >- RWT.getSettingStore().addSettingStoreListener( rwtListener ); >- } else { // !trackChanges >- if( rwtListener != null ) { >- RWT.getSettingStore().removeSettingStoreListener( rwtListener ); >- } >- } >- } >- >- public void addNodeChangeListener( final INodeChangeListener listener ) { >- nodeListeners.add( listener ); >- } >- >- public void removeNodeChangeListener( final INodeChangeListener listener ) { >- nodeListeners.remove( listener ); >- } >- >- public void fireNodeEvent( final Preferences child, >- final boolean wasAdded, >- final SessionPreferencesNode spn ) >- { >- final NodeChangeEvent event = new NodeChangeEvent( spn, child ); >- Object[] listeners = nodeListeners.getListeners(); >- for( int i = 0; i < listeners.length; i++ ) { >- final INodeChangeListener listener >- = ( INodeChangeListener )listeners[ i ]; >- ISafeRunnable op = new ISafeRunnable() { >- public void handleException( final Throwable exception ) { >- // logged by SafeRunner >- } >- public void run() throws Exception { >- if( wasAdded ) { >- listener.added( event ); >- } else { >- listener.removed( event ); >- } >- } >- }; >- SafeRunner.run( op ); >- } >- >- } >- >-} >Index: Eclipse UI/org/eclipse/ui/internal/preferences/WorkbenchFileSettingStoreFactory.java >=================================================================== >RCS file: Eclipse UI/org/eclipse/ui/internal/preferences/WorkbenchFileSettingStoreFactory.java >diff -N Eclipse UI/org/eclipse/ui/internal/preferences/WorkbenchFileSettingStoreFactory.java >--- Eclipse UI/org/eclipse/ui/internal/preferences/WorkbenchFileSettingStoreFactory.java 13 Jun 2008 06:31:15 -0000 1.5 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,85 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2008 Innoopract Informationssysteme GmbH. >- * 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >-package org.eclipse.ui.internal.preferences; >- >- >-import java.io.File; >- >-import org.eclipse.core.runtime.IPath; >-import org.eclipse.core.runtime.Platform; >-import org.eclipse.rwt.RWT; >-import org.eclipse.rwt.internal.util.ParamCheck; >-import org.eclipse.rwt.service.*; >-import org.eclipse.ui.PlatformUI; >-import org.osgi.framework.Bundle; >- >- >-/** >- * {@link ISettingStoreFactory} that creates {@link FileSettingStore} >- * instances. >- * <p> >- * This particular implementation uses the following strategy to determine >- * the path for persisting the data of a FileSettingStore: >- * <ol> >- * <li>Use the directory specified by the system property >- * <code>"org.eclipse.rwt.service.FileSettingStore.dir"</code>. >- * </li> >- * <li>Use a subdirectory in the state location of the >- * org.eclipse.rap.ui.workbench bundle. >- * </li> >- * </ol> >- * The first path that can be obtained from the above choices (in the order >- * given above) will be used. If the path determined does not exist it will >- * be created. >- * <p> >- * <b>Note:</b> This setting store factory should be used in a regular >- * RAP deployment. For an RWT only deployment use the >- * {@link RWTFileSettingStoreFactory}. >- * >- */ >-public final class WorkbenchFileSettingStoreFactory >- implements ISettingStoreFactory >-{ >- >- public ISettingStore createSettingStore( final String storeId ) { >- ParamCheck.notNullOrEmpty( storeId, "storeId" ); //$NON-NLS-1$ >- ISettingStore result = new FileSettingStore( getWorkDir() ); >- try { >- result.loadById( storeId ); >- } catch( SettingStoreException sse ) { >- String msg = String.valueOf( sse.getMessage() ); >- RWT.getRequest().getSession().getServletContext().log( msg, sse ); >- } >- return result; >- } >- >- ////////////////// >- // helping methods >- >- private File getWorkDir() { >- File result = getWorkDirFromEnvironment(); >- if( result == null ) { >- Bundle bundle = Platform.getBundle( PlatformUI.PLUGIN_ID ); >- IPath stateLoc = Platform.getStateLocation( bundle ); >- File parentDir = stateLoc.toFile(); >- result = new File( parentDir, FileSettingStore.class.getName() ); >- } >- if( !result.exists() ) { >- result.mkdirs(); >- } >- return result; >- } >- >- private File getWorkDirFromEnvironment() { >- String path = System.getProperty( FileSettingStore.FILE_SETTING_STORE_DIR ); >- return ( path != null ) ? new File( path ) : null; >- } >-} >Index: Eclipse UI/org/eclipse/ui/internal/preferences/SessionPreferencesFactory.java >=================================================================== >RCS file: Eclipse UI/org/eclipse/ui/internal/preferences/SessionPreferencesFactory.java >diff -N Eclipse UI/org/eclipse/ui/internal/preferences/SessionPreferencesFactory.java >--- Eclipse UI/org/eclipse/ui/internal/preferences/SessionPreferencesFactory.java 26 May 2009 15:30:19 -0000 1.4 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,27 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2008 Innoopract Informationssysteme GmbH. >- * 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >-package org.eclipse.ui.internal.preferences; >- >-import org.eclipse.core.runtime.preferences.IEclipsePreferences; >-import org.eclipse.core.runtime.preferences.IScope; >- >-/** >- * Creates "session" scoped preference nodes. >- */ >-public final class SessionPreferencesFactory implements IScope { >- >- public IEclipsePreferences create( final IEclipsePreferences parent, >- final String name ) >- { >- return new SessionPreferencesNode( parent, name ); >- } >- >-} >Index: Eclipse UI/org/eclipse/ui/internal/preferences/Base64.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.ui/org.eclipse.rap.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/Base64.java,v >retrieving revision 1.1 >diff -u -r1.1 Base64.java >--- Eclipse UI/org/eclipse/ui/internal/preferences/Base64.java 17 Apr 2008 12:04:07 -0000 1.1 >+++ Eclipse UI/org/eclipse/ui/internal/preferences/Base64.java 11 Sep 2009 08:35:39 -0000 >@@ -15,7 +15,9 @@ > * from base 64 encoded Strings. > * > */ >-class Base64 { >+// RAP [bm]: made public to allow access from org.eclipse.rap.ui >+//class Base64 { >+public class Base64 { > > private static final byte equalSign = (byte) '='; > >Index: Eclipse UI/org/eclipse/ui/internal/preferences/SessionPreferencesNode.java >=================================================================== >RCS file: Eclipse UI/org/eclipse/ui/internal/preferences/SessionPreferencesNode.java >diff -N Eclipse UI/org/eclipse/ui/internal/preferences/SessionPreferencesNode.java >--- Eclipse UI/org/eclipse/ui/internal/preferences/SessionPreferencesNode.java 26 May 2009 15:30:20 -0000 1.4 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,507 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2008 Innoopract Informationssysteme GmbH. >- * 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >-package org.eclipse.ui.internal.preferences; >- >-import java.util.*; >- >-import org.eclipse.core.runtime.preferences.IEclipsePreferences; >-import org.eclipse.core.runtime.preferences.IPreferenceNodeVisitor; >-import org.eclipse.osgi.util.NLS; >-import org.eclipse.rwt.RWT; >-import org.eclipse.rwt.internal.util.ParamCheck; >-import org.eclipse.rwt.service.ISettingStore; >-import org.eclipse.rwt.service.SettingStoreException; >-import org.osgi.service.prefs.BackingStoreException; >-import org.osgi.service.prefs.Preferences; >- >-/** >- * This node use the RWT setting store to persist its preferences. >- */ >-final class SessionPreferencesNode implements IEclipsePreferences { >- >- private static final String PATH_SEPARATOR = "/"; //$NON-NLS-1$ >- private static final String DOUBLE_PATH_SEPARATOR = "//"; //$NON-NLS-1$ >- private static final String TRUE = "true"; //$NON-NLS-1$ >- private static final String FALSE = "false"; //$NON-NLS-1$ >- >- private final String name; >- private final IEclipsePreferences parent; >- private boolean isRemoved; >- /* cache the absolutePath once it has been computed */ >- private String absolutePath; >- >- private final Map children = new HashMap(); // !thread safe >- >- SessionPreferencesNode( final IEclipsePreferences parent, >- final String name ) >- { >- ParamCheck.notNull( parent, "parent" ); //$NON-NLS-1$ >- ParamCheck.notNull( name, "name" ); //$NON-NLS-1$ >- checkName( name ); >- this.parent = parent; >- this.name = name; >- } >- >- public void accept( final IPreferenceNodeVisitor visitor ) >- throws BackingStoreException >- { >- boolean withChildren = visitor.visit( this ); >- if( withChildren ) { >- Object[] childrenArray; >- synchronized( this ) { >- childrenArray = children.values().toArray(); >- } >- for( int i = 0; i < childrenArray.length; i++ ) { >- IEclipsePreferences child = ( IEclipsePreferences )childrenArray[ i ]; >- child.accept( visitor ); >- } >- } >- } >- >- public void addNodeChangeListener( final INodeChangeListener listener ) { >- checkRemoved(); >- if( listener != null ) { >- getNodeCore().addNodeChangeListener( listener ); >- } >- } >- >- public void addPreferenceChangeListener( >- final IPreferenceChangeListener listener ) >- { >- checkRemoved(); >- getNodeCore().addPreferenceChangeListener( listener ); >- } >- >- public Preferences node( final String path ) { >- checkPath( path ); >- checkRemoved(); >- Preferences result; >- if( "".equals( path ) ) { // "" //$NON-NLS-1$ >- result = this; >- } else if( path.startsWith( PATH_SEPARATOR ) ) { // "/absolute/path" >- result = findRoot().node( path.substring( 1 ) ); >- } else if( path.indexOf( PATH_SEPARATOR ) > 0 ) { // "foo/bar/baz" >- int index = path.indexOf( PATH_SEPARATOR ); >- String nodeName = path.substring( 0, index ); >- String rest = path.substring( index + 1, path.length() ); >- result = getChild( nodeName, true ).node( rest ); >- } else { // "foo" >- result = getChild( path, true ); >- } >- return result; >- } >- >- public synchronized void removeNode() throws BackingStoreException { >- checkRemoved(); >- // remove all preferences >- clear(); >- // remove all children >- Object[] childNodes = children.values().toArray(); >- for( int i = 0; i < childNodes.length; i++ ) { >- Preferences child = ( Preferences )childNodes[ i ]; >- if( child.nodeExists( "" ) ) { // if !removed //$NON-NLS-1$ >- child.removeNode(); >- } >- } >- // remove from parent; this is ugly, because the interface >- // Preference has no API for removing oneself from the parent. >- // In general the parent will be a SessionPreferencesNode. >- // The only case in the workbench where this is not true, is one level >- // below the root (i.e. at /session ), but the scope root must not >- // be removable (see IEclipsePreferences#removeNode()) >- if( parent instanceof SessionPreferencesNode ) { >- // this means: >- // (a) we know what kind of parent we have, and >- // (b) we are not the scope root, since that has a >- /// RootPreference as a parent >- SessionPreferencesNode spnParent >- = ( ( SessionPreferencesNode ) parent ); >- spnParent.children.remove( name ); >- spnParent.fireNodeEvent( this, false ); >- >- // the listeners are not needed anymore >- getNodeCore().clear(); >- children.clear(); >- isRemoved = true; >- } >- } >- >- public void removeNodeChangeListener( final INodeChangeListener listener ) { >- checkRemoved(); >- if( listener != null ) { >- getNodeCore().removeNodeChangeListener( listener ); >- } >- } >- >- public void removePreferenceChangeListener( >- final IPreferenceChangeListener listener ) >- { >- checkRemoved(); >- getNodeCore().removePreferenceChangeListener( listener ); >- } >- >- public String absolutePath() { >- if( absolutePath == null ) { >- if( parent == null ) { >- absolutePath = name; >- } else { >- String parentPath = parent.absolutePath(); >- absolutePath = parentPath.endsWith( PATH_SEPARATOR ) >- ? parentPath + name >- : parentPath + PATH_SEPARATOR + name; >- } >- } >- return absolutePath; >- } >- >- public synchronized String[] childrenNames() { >- checkRemoved(); >- Set names = children.keySet(); >- return ( String[] )names.toArray( new String[ names.size() ] ); >- } >- >- public void clear() { >- checkRemoved(); >- String[] keys = internalGetKeys(); >- for( int i = 0; i < keys.length; i++ ) { >- remove( keys[ i ] ); >- } >- } >- >- public void flush() { >- checkRemoved(); >- // the current implementation persists everytime the preferences >- // are modified, so there's nothing to do here >- } >- >- public String get( final String key, final String def ) { >- ParamCheck.notNull( key, "key" ); //$NON-NLS-1$ >- checkRemoved(); >- String result = internalGet( key ); >- return result == null ? def : result; >- } >- >- public boolean getBoolean( final String key, final boolean def ) { >- ParamCheck.notNull( key, "key" ); //$NON-NLS-1$ >- checkRemoved(); >- String value = internalGet( key ); >- return value == null ? def : Boolean.valueOf( value ).booleanValue(); >- } >- >- public byte[] getByteArray( final String key, final byte[] def ) { >- ParamCheck.notNull( key, "key" ); //$NON-NLS-1$ >- checkRemoved(); >- String value = internalGet( key ); >- return value == null ? def : Base64.decode( value.getBytes() ); >- } >- >- public double getDouble( final String key, final double def ) { >- ParamCheck.notNull( key, "key" ); //$NON-NLS-1$ >- checkRemoved(); >- String value = internalGet( key ); >- double result = def; >- if( value != null ) { >- try { >- result = Double.parseDouble( value ); >- } catch( NumberFormatException nfe ) { >- // returns def >- } >- } >- return result; >- } >- >- public float getFloat( final String key, final float def ) { >- ParamCheck.notNull( key, "key" ); //$NON-NLS-1$ >- checkRemoved(); >- String value = internalGet( key ); >- float result = def; >- if( value != null ) { >- try { >- result = Float.parseFloat( value ); >- } catch( NumberFormatException nfe ) { >- // returns def >- } >- } >- return result; >- } >- >- public int getInt( final String key, final int def ) { >- ParamCheck.notNull( key, "key" ); //$NON-NLS-1$ >- checkRemoved(); >- String value = internalGet( key ); >- int result = def; >- if( value != null ) { >- try { >- result = Integer.parseInt( value ); >- } catch( NumberFormatException nfe ) { >- // returns def >- } >- } >- return result; >- } >- >- public long getLong( final String key, final long def ) { >- ParamCheck.notNull( key, "key" ); //$NON-NLS-1$ >- checkRemoved(); >- String value = internalGet( key ); >- long result = def; >- if( value != null ) { >- try { >- result = Long.parseLong( value ); >- } catch( NumberFormatException nfe ) { >- // returns def >- } >- } >- return result; >- } >- >- public String[] keys() { >- checkRemoved(); >- return internalGetKeys(); >- } >- >- public String name() { >- return name; >- } >- >- public synchronized boolean nodeExists( final String path ) >- throws BackingStoreException >- { >- boolean result; >- if( "".equals( path ) ) { //$NON-NLS-1$ >- result = !isRemoved; >- } else { >- checkRemoved(); >- checkPath( path ); >- if( path.startsWith( PATH_SEPARATOR ) ) { // "/absolute/path" >- result = findRoot().nodeExists( path.substring( 1 ) ); >- } else if( path.indexOf( PATH_SEPARATOR ) > 0 ) { // "foo/bar/baz" >- int index = path.indexOf( PATH_SEPARATOR ); >- String nodeName = path.substring( 0, index ); >- String rest = path.substring( index + 1, path.length() ); >- SessionPreferencesNode child = getChild( nodeName, false ); >- result = child == null ? false : child.nodeExists( rest ); >- } else { // "foo" >- result = children.containsKey( path ); >- } >- } >- return result; >- } >- >- public Preferences parent() { >- checkRemoved(); >- return parent; >- } >- >- public void put( final String key, final String newValue ) { >- ParamCheck.notNull( key, "key" ); //$NON-NLS-1$ >- ParamCheck.notNull( newValue, "newValue" ); //$NON-NLS-1$ >- checkRemoved(); >- String oldValue = internalPut( key, newValue ); >- if( !newValue.equals( oldValue ) ) { >- getNodeCore().firePreferenceEvent( key, oldValue, newValue ); >- } >- } >- >- public void putBoolean( final String key, final boolean value ) { >- ParamCheck.notNull( key, "key" ); //$NON-NLS-1$ >- checkRemoved(); >- String newValue = value ? TRUE : FALSE; >- String oldValue = internalPut( key, newValue ); >- if( !newValue.equals( oldValue ) ) { >- getNodeCore().firePreferenceEvent( key, oldValue, newValue ); >- } >- } >- >- public void putByteArray( final String key, final byte[] value ) { >- ParamCheck.notNull( key, "key" ); //$NON-NLS-1$ >- ParamCheck.notNull( value, "newValue" ); //$NON-NLS-1$ >- checkRemoved(); >- String newValue = new String( Base64.encode( value ) ); >- String oldValue = internalPut( key, newValue ); >- if( !newValue.equals( oldValue) ) { >- getNodeCore().firePreferenceEvent( key, oldValue, newValue ); >- } >- } >- >- public void putDouble( final String key, final double value ) { >- ParamCheck.notNull( key, "key" ); //$NON-NLS-1$ >- checkRemoved(); >- String newValue = String.valueOf( value ); >- String oldValue = internalPut( key, newValue ); >- if( !newValue.equals( oldValue ) ) { >- getNodeCore().firePreferenceEvent( key, oldValue, newValue ); >- } >- } >- >- public void putFloat( final String key, final float value ) { >- ParamCheck.notNull( key, "key" ); //$NON-NLS-1$ >- checkRemoved(); >- String newValue = String.valueOf( value ); >- String oldValue = internalPut( key, newValue ); >- if( !newValue.equals( oldValue ) ) { >- getNodeCore().firePreferenceEvent( key, oldValue, newValue ); >- } >- } >- >- public void putInt( final String key, final int value ) { >- ParamCheck.notNull( key, "key" ); //$NON-NLS-1$ >- checkRemoved(); >- String newValue = String.valueOf( value ); >- String oldValue = internalPut( key, newValue ); >- if( !newValue.equals( oldValue ) ) { >- getNodeCore().firePreferenceEvent( key, oldValue, newValue ); >- } >- } >- >- public void putLong( final String key, final long value ) { >- ParamCheck.notNull( key, "key" ); //$NON-NLS-1$ >- checkRemoved(); >- String newValue = String.valueOf( value ); >- String oldValue = internalPut( key, newValue ); >- if( !newValue.equals( oldValue ) ) { >- getNodeCore().firePreferenceEvent( key, oldValue, newValue ); >- } >- } >- >- public void remove( final String key ) { >- checkRemoved(); >- String oldValue = internalGet( key ); >- if( oldValue != null ) { >- internalPut( key, null ); >- getNodeCore().firePreferenceEvent( key, oldValue, null ); >- } >- } >- >- public void sync() throws BackingStoreException { >- checkRemoved(); >- ISettingStore store = RWT.getSettingStore(); >- String id = store.getId(); >- try { >- store.loadById( id ); >- } catch( SettingStoreException sse ) { >- throw new BackingStoreException( "Failed to sync() node", sse ); //$NON-NLS-1$ >- } >- } >- >- public String toString() { >- return absolutePath() + "@" + hashCode(); //$NON-NLS-1$ >- } >- >- ////////////////// >- // helping methods >- >- private void checkName( final String nodeName ) { >- if( nodeName.indexOf( PATH_SEPARATOR ) != -1 ) { >- String unboundMsg = "Name ''{0}'' cannot contain or end with ''{1}''"; //$NON-NLS-1$ >- String msg = NLS.bind( unboundMsg, nodeName, PATH_SEPARATOR ); >- throw new IllegalArgumentException( msg ); >- } >- } >- >- private void checkPath( final String path ) { >- if( path.indexOf( DOUBLE_PATH_SEPARATOR ) != -1 ) { >- String unboundMsg = "''{0}'' is not allowed in path ''{1}''"; //$NON-NLS-1$ >- String msg = NLS.bind( unboundMsg, DOUBLE_PATH_SEPARATOR, path ); >- throw new IllegalArgumentException( msg ); >- } >- if( path.length() > 1 && path.endsWith( PATH_SEPARATOR ) ) { >- String unboundMsg = "path ''{0}'' cannot end with ''{1}''"; //$NON-NLS-1$ >- String msg = NLS.bind( unboundMsg, path, PATH_SEPARATOR ); >- throw new IllegalArgumentException( msg ); >- } >- } >- >- private synchronized void checkRemoved() { >- if( isRemoved ) { >- String msg = "node ''{0}'' has been removed"; //$NON-NLS-1$ >- throw new IllegalStateException( NLS.bind( msg, this.absolutePath() ) ); >- } >- } >- >- private synchronized SessionPreferencesNode createChild( >- final String childName ) >- { >- SessionPreferencesNode result >- = new SessionPreferencesNode( this, childName ); >- children.put( childName, result ); >- fireNodeEvent( result, true ); >- return result; >- } >- >- private synchronized SessionPreferencesNode getChild( >- final String childName, >- final boolean doCreate ) >- { >- SessionPreferencesNode result >- = ( SessionPreferencesNode )children.get( childName ); >- if( result == null && doCreate ) { >- result = createChild( childName ); >- } >- return result; >- } >- >- private String[] internalGetKeys() { >- List result = new ArrayList(); >- >- String prefix = absolutePath() + PATH_SEPARATOR; >- int prefixLength = prefix.length(); >- >- Enumeration attrNames = RWT.getSettingStore().getAttributeNames(); >- while( attrNames.hasMoreElements() ) { >- String attr = ( String )attrNames.nextElement(); >- if( attr.startsWith( prefix ) ) { >- String key = attr.substring( prefixLength ); >- result.add( key ); >- } >- } >- return ( String[] )result.toArray( new String[ result.size() ] ); >- } >- >- private Preferences findRoot() { >- Preferences result = this; >- while( result.parent() != null ) { >- result = result.parent(); >- } >- return result; >- } >- >- private String internalGet( final String key ) { >- ISettingStore store = RWT.getSettingStore(); >- String uniqueKey = absolutePath() + PATH_SEPARATOR + key; >- return store.getAttribute( uniqueKey ); >- } >- >- private synchronized String internalPut( final String key, >- final String value ) { >- String uniqueKey = absolutePath() + PATH_SEPARATOR + key; >- return getNodeCore().put( uniqueKey, value ); >- } >- >- private void fireNodeEvent( final Preferences child, >- final boolean wasAdded ) { >- getNodeCore().fireNodeEvent( child, wasAdded, this ); >- } >- >- private SessionPreferenceNodeCore getNodeCore() { >- SessionPreferenceNodeCore result; >- final String key = absolutePath(); >- Object object = RWT.getSessionStore().getAttribute( key ); >- if( object instanceof SessionPreferenceNodeCore ) { >- result = ( SessionPreferenceNodeCore )object; >- } else { >- result = new SessionPreferenceNodeCore( this ); >- RWT.getSessionStore().setAttribute( key, result ); >- } >- return result; >- } >- >-} >Index: Eclipse UI/org/eclipse/ui/internal/preferences/SessionScope.java >=================================================================== >RCS file: Eclipse UI/org/eclipse/ui/internal/preferences/SessionScope.java >diff -N Eclipse UI/org/eclipse/ui/internal/preferences/SessionScope.java >--- Eclipse UI/org/eclipse/ui/internal/preferences/SessionScope.java 26 May 2009 15:30:13 -0000 1.5 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,70 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2008 Innoopract Informationssysteme GmbH. >- * 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >-package org.eclipse.ui.internal.preferences; >- >-import org.eclipse.core.runtime.IPath; >-import org.eclipse.core.runtime.Platform; >-import org.eclipse.core.runtime.preferences.IEclipsePreferences; >-import org.eclipse.core.runtime.preferences.IScopeContext; >-import org.eclipse.rwt.RWT; >-import org.eclipse.rwt.internal.util.ParamCheck; >-import org.eclipse.rwt.service.FileSettingStore; >- >-// TODO [fappel]: think about how we can provide this as API (subset rule >-// of RAP/RCP) >-/** >- * Object representing the session scope in the Eclipse preferences >- * hierarchy. Can be used as a context for searching for preference >- * values (in the IPreferenceService APIs) or for determining the >- * corrent preference node to set values in the store. >- * <p> >- * Session preferences are stored on a <i>per-session</i> basis using >- * the underlying RWT SettingStore (see {@link RWT#getSettingStore()}. >- * Preferences saved during a previous session will be retrieved, as long as >- * the user can identify himself with the setting store cookie. Session >- * preferences are persisted using the setting store implementation >- * that is configured for the application (see {@link FileSettingStore}. >- * <p> >- * The path for preferences defined in the session scope hierarchy is: >- * <code>/session/<qualifier></code> >- * <p> >- * This class is not intented to be subclassed. It may be instantiated. >- * >- */ >-public final class SessionScope implements IScopeContext { >- >- /** >- * String constant (value of <code>"session"</code>) used for the >- * scope name for the session preference scope. >- */ >- public static final String SCOPE = "session"; //$NON-NLS-1$ >- >- /** >- * Create and return a new session scope instance. >- */ >- public SessionScope() { >- super(); >- } >- >- public IPath getLocation() { >- return null; >- } >- >- public String getName() { >- return SCOPE; >- } >- >- public IEclipsePreferences getNode( String qualifier ) { >- ParamCheck.notNull( qualifier, "qualifier" ); //$NON-NLS-1$ >- IEclipsePreferences root = Platform.getPreferencesService().getRootNode(); >- return ( IEclipsePreferences ) root.node( SCOPE ).node( qualifier ); >- } >-} >Index: Eclipse UI/org/eclipse/ui/plugin/AbstractUIPlugin.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.ui/org.eclipse.rap.ui.workbench/Eclipse UI/org/eclipse/ui/plugin/AbstractUIPlugin.java,v >retrieving revision 1.3 >diff -u -r1.3 AbstractUIPlugin.java >--- Eclipse UI/org/eclipse/ui/plugin/AbstractUIPlugin.java 6 May 2008 15:57:12 -0000 1.3 >+++ Eclipse UI/org/eclipse/ui/plugin/AbstractUIPlugin.java 11 Sep 2009 08:35:40 -0000 >@@ -29,13 +29,13 @@ > import org.eclipse.jface.preference.IPreferenceStore; > import org.eclipse.jface.resource.ImageDescriptor; > import org.eclipse.jface.resource.ImageRegistry; >+import org.eclipse.rap.ui.internal.preferences.SessionScope; > import org.eclipse.swt.SWT; > import org.eclipse.swt.SWTError; > import org.eclipse.swt.widgets.Display; > import org.eclipse.ui.IWorkbench; > import org.eclipse.ui.PlatformUI; > import org.eclipse.ui.internal.WWinPluginAction; >-import org.eclipse.ui.internal.preferences.SessionScope; > import org.eclipse.ui.internal.util.BundleUtility; > import org.eclipse.ui.preferences.ScopedPreferenceStore; > import org.osgi.framework.Bundle; >Index: Eclipse UI/org/eclipse/ui/internal/WorkbenchPlugin.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.ui/org.eclipse.rap.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPlugin.java,v >retrieving revision 1.19 >diff -u -r1.19 WorkbenchPlugin.java >--- Eclipse UI/org/eclipse/ui/internal/WorkbenchPlugin.java 7 Aug 2009 11:03:19 -0000 1.19 >+++ Eclipse UI/org/eclipse/ui/internal/WorkbenchPlugin.java 11 Sep 2009 08:35:39 -0000 >@@ -30,6 +30,7 @@ > import org.eclipse.jface.resource.ImageRegistry; > import org.eclipse.jface.window.Window; > import org.eclipse.rap.ui.internal.branding.BrandingExtension; >+import org.eclipse.rap.ui.internal.progress.JobManagerAdapter; > import org.eclipse.rap.ui.internal.servlet.EntryPointExtension; > import org.eclipse.rap.ui.internal.servlet.HttpServiceTracker; > import org.eclipse.rwt.RWT; >@@ -51,7 +52,6 @@ > import org.eclipse.ui.internal.intro.IntroRegistry; > import org.eclipse.ui.internal.misc.StatusUtil; > import org.eclipse.ui.internal.operations.WorkbenchOperationSupport; >-import org.eclipse.ui.internal.progress.JobManagerAdapter; > import org.eclipse.ui.internal.progress.ProgressManager; > import org.eclipse.ui.internal.registry.ActionSetRegistry; > import org.eclipse.ui.internal.registry.EditorRegistry; >Index: Eclipse UI/org/eclipse/ui/internal/Workbench.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.ui/org.eclipse.rap.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java,v >retrieving revision 1.21 >diff -u -r1.21 Workbench.java >--- Eclipse UI/org/eclipse/ui/internal/Workbench.java 10 Sep 2009 10:55:57 -0000 1.21 >+++ Eclipse UI/org/eclipse/ui/internal/Workbench.java 11 Sep 2009 08:35:39 -0000 >@@ -37,6 +37,8 @@ > import org.eclipse.jface.viewers.ISelection; > import org.eclipse.jface.window.*; > import org.eclipse.osgi.util.NLS; >+import org.eclipse.rap.ui.internal.RealmAdapterHook; >+import org.eclipse.rap.ui.internal.SessionSingletonEventManager; > import org.eclipse.rwt.RWT; > import org.eclipse.rwt.internal.branding.BrandingUtil; > import org.eclipse.rwt.internal.service.ContextProvider; >Index: Eclipse UI/org/eclipse/ui/preferences/ScopedPreferenceStore.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.ui/org.eclipse.rap.ui.workbench/Eclipse UI/org/eclipse/ui/preferences/ScopedPreferenceStore.java,v >retrieving revision 1.4 >diff -u -r1.4 ScopedPreferenceStore.java >--- Eclipse UI/org/eclipse/ui/preferences/ScopedPreferenceStore.java 21 Jan 2009 18:48:39 -0000 1.4 >+++ Eclipse UI/org/eclipse/ui/preferences/ScopedPreferenceStore.java 11 Sep 2009 08:35:40 -0000 >@@ -20,9 +20,9 @@ > import org.eclipse.jface.preference.IPersistentPreferenceStore; > import org.eclipse.jface.preference.IPreferenceStore; > import org.eclipse.jface.util.IPropertyChangeListener; >+import org.eclipse.rap.ui.internal.preferences.SessionScope; > import org.eclipse.rwt.RWT; > import org.eclipse.rwt.service.ISessionStore; >-import org.eclipse.ui.internal.preferences.SessionScope; > > /** > * The ScopedPreferenceStore is an IPreferenceStore that uses the scopes >Index: Eclipse UI/org/eclipse/ui/internal/progress/WorkbenchSiteProgressService.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.ui/org.eclipse.rap.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/WorkbenchSiteProgressService.java,v >retrieving revision 1.3 >diff -u -r1.3 WorkbenchSiteProgressService.java >--- Eclipse UI/org/eclipse/ui/internal/progress/WorkbenchSiteProgressService.java 16 Sep 2008 16:26:28 -0000 1.3 >+++ Eclipse UI/org/eclipse/ui/internal/progress/WorkbenchSiteProgressService.java 11 Sep 2009 08:35:40 -0000 >@@ -28,6 +28,7 @@ > import org.eclipse.jface.operation.IRunnableWithProgress; > import org.eclipse.jface.resource.ImageDescriptor; > import org.eclipse.jface.util.IPropertyChangeListener; >+import org.eclipse.rap.ui.internal.progress.ProgressUtil; > import org.eclipse.rwt.graphics.Graphics; > import org.eclipse.swt.SWT; > import org.eclipse.swt.graphics.Image; >Index: Eclipse UI/org/eclipse/ui/internal/progress/IJobMarker.java >=================================================================== >RCS file: Eclipse UI/org/eclipse/ui/internal/progress/IJobMarker.java >diff -N Eclipse UI/org/eclipse/ui/internal/progress/IJobMarker.java >--- Eclipse UI/org/eclipse/ui/internal/progress/IJobMarker.java 12 Jun 2008 16:29:52 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,20 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2002, 2008 Innoopract Informationssysteme GmbH. >- * 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >- >-package org.eclipse.ui.internal.progress; >- >-// RAP [fappel]: This is a helper class used to avoid a memory leak due to >-// thread management. >-// Note that this is still under investigation. >-// See comment in JobManagerAdapter >-public interface IJobMarker { >- boolean canBeRemoved(); >-} >Index: Eclipse UI/org/eclipse/ui/internal/progress/ProgressMonitorFocusJobDialog.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.ui/org.eclipse.rap.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressMonitorFocusJobDialog.java,v >retrieving revision 1.5 >diff -u -r1.5 ProgressMonitorFocusJobDialog.java >--- Eclipse UI/org/eclipse/ui/internal/progress/ProgressMonitorFocusJobDialog.java 29 Apr 2009 13:24:47 -0000 1.5 >+++ Eclipse UI/org/eclipse/ui/internal/progress/ProgressMonitorFocusJobDialog.java 11 Sep 2009 08:35:40 -0000 >@@ -16,6 +16,8 @@ > import org.eclipse.core.runtime.*; > import org.eclipse.core.runtime.jobs.*; > import org.eclipse.jface.dialogs.IDialogConstants; >+import org.eclipse.rap.ui.internal.progress.JobCanceler; >+import org.eclipse.rap.ui.internal.progress.ProgressUtil; > import org.eclipse.rwt.RWT; > import org.eclipse.rwt.internal.lifecycle.RWTLifeCycle; > import org.eclipse.rwt.internal.service.ContextProvider; >Index: Eclipse UI/org/eclipse/ui/internal/progress/ProgressAnimationProcessor.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.ui/org.eclipse.rap.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressAnimationProcessor.java,v >retrieving revision 1.2 >diff -u -r1.2 ProgressAnimationProcessor.java >--- Eclipse UI/org/eclipse/ui/internal/progress/ProgressAnimationProcessor.java 23 Apr 2008 15:02:16 -0000 1.2 >+++ Eclipse UI/org/eclipse/ui/internal/progress/ProgressAnimationProcessor.java 11 Sep 2009 08:35:39 -0000 >@@ -17,6 +17,7 @@ > import org.eclipse.core.runtime.Assert; > import org.eclipse.core.runtime.IProgressMonitor; > import org.eclipse.core.runtime.jobs.Job; >+import org.eclipse.rap.ui.internal.progress.ProgressUtil; > > /** > * The ProgressAnimationProcessor is the processor for the animation using the >Index: Eclipse UI/org/eclipse/ui/internal/progress/ProgressUtil.java >=================================================================== >RCS file: Eclipse UI/org/eclipse/ui/internal/progress/ProgressUtil.java >diff -N Eclipse UI/org/eclipse/ui/internal/progress/ProgressUtil.java >--- Eclipse UI/org/eclipse/ui/internal/progress/ProgressUtil.java 12 Jun 2008 16:29:52 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,34 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2002, 2008 Innoopract Informationssysteme GmbH. >- * 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >- >-package org.eclipse.ui.internal.progress; >- >-import org.eclipse.rwt.lifecycle.UICallBack; >-import org.eclipse.swt.widgets.Display; >-import org.eclipse.ui.PlatformUI; >- >-// RAP [fappel]: >-public final class ProgressUtil { >- >- private ProgressUtil() { >- // prevent instance creation >- } >- >- public static boolean isWorkbenchRunning( final Display display ) { >- final boolean[] result = new boolean[ 1 ]; >- UICallBack.runNonUIThreadWithFakeContext( display, new Runnable() { >- public void run() { >- result[ 0 ] = PlatformUI.isWorkbenchRunning(); >- } >- } ); >- return result[ 0 ]; >- } >-} >Index: Eclipse UI/org/eclipse/ui/internal/progress/JobCanceler.java >=================================================================== >RCS file: Eclipse UI/org/eclipse/ui/internal/progress/JobCanceler.java >diff -N Eclipse UI/org/eclipse/ui/internal/progress/JobCanceler.java >--- Eclipse UI/org/eclipse/ui/internal/progress/JobCanceler.java 23 Apr 2008 15:02:16 -0000 1.1 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,46 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2002-2006 Innoopract Informationssysteme GmbH. >- * 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >- >-package org.eclipse.ui.internal.progress; >- >-import org.eclipse.core.runtime.jobs.IJobChangeEvent; >-import org.eclipse.core.runtime.jobs.IJobChangeListener; >- >-// RAP [fappel]: This is a helper class used to avoid a memory leak due to >-// thread management. >-// Note that this is still under investigation. >-// See comment in JobManagerAdapter >-final class JobCanceler implements IJobChangeListener { >- >- public void aboutToRun( IJobChangeEvent event ) { >- event.getJob().cancel(); >- } >- >- public void awake( IJobChangeEvent event ) { >- event.getJob().cancel(); >- } >- >- public void done( IJobChangeEvent event ) { >- event.getJob().cancel(); >- } >- >- public void running( IJobChangeEvent event ) { >- event.getJob().cancel(); >- } >- >- public void scheduled( IJobChangeEvent event ) { >- event.getJob().cancel(); >- } >- >- public void sleeping( IJobChangeEvent event ) { >- event.getJob().cancel(); >- } >-} >\ No newline at end of file >Index: Eclipse UI/org/eclipse/ui/internal/progress/JobManagerAdapter.java >=================================================================== >RCS file: Eclipse UI/org/eclipse/ui/internal/progress/JobManagerAdapter.java >diff -N Eclipse UI/org/eclipse/ui/internal/progress/JobManagerAdapter.java >--- Eclipse UI/org/eclipse/ui/internal/progress/JobManagerAdapter.java 28 Aug 2009 14:34:32 -0000 1.5 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,244 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2007, 2008 Innoopract Informationssysteme GmbH. >- * 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >-package org.eclipse.ui.internal.progress; >- >-import java.lang.reflect.Field; >-import java.util.*; >- >-import javax.servlet.http.HttpSessionBindingEvent; >-import javax.servlet.http.HttpSessionBindingListener; >- >-import org.eclipse.core.runtime.IProgressMonitor; >-import org.eclipse.core.runtime.jobs.*; >-import org.eclipse.rwt.RWT; >-import org.eclipse.rwt.internal.lifecycle.RWTLifeCycle; >-import org.eclipse.rwt.internal.service.ContextProvider; >-import org.eclipse.rwt.lifecycle.UICallBack; >-import org.eclipse.rwt.service.ISessionStore; >-import org.eclipse.swt.widgets.Display; >- >-// RAP [fappel]: >-public class JobManagerAdapter >- extends ProgressProvider >- implements IJobChangeListener >-{ >- >- private static JobManagerAdapter _instance; >- private final Map jobs; >- private final ProgressManager defaultProgressManager; >- final Object lock; >- >- public static synchronized JobManagerAdapter getInstance() { >- if( _instance == null ) { >- _instance = new JobManagerAdapter(); >- } >- return _instance; >- } >- >- >- private JobManagerAdapter() { >- // To avoid deadlocks we have to use the same synchronisation lock. >- // If anyone has a better idea - you're welcome. >- IJobManager jobManager = Job.getJobManager(); >- Class clazz = jobManager.getClass(); >- try { >- Field jobManagerLock = clazz.getDeclaredField( "lock" ); >- jobManagerLock.setAccessible( true ); >- lock = jobManagerLock.get( jobManager ); >- } catch( final Throwable thr ) { >- String msg = "Could not initialize synchronization lock."; >- throw new IllegalStateException( msg ); >- } >- jobs = new HashMap(); >- defaultProgressManager = new ProgressManager(); >- Job.getJobManager().setProgressProvider( this ); >- Job.getJobManager().addJobChangeListener( this ); >- } >- >- >- /////////////////////////////// >- // ProgressProvider >- >- public IProgressMonitor createMonitor( final Job job ) { >- ProgressManager manager = findProgressManager( job ); >- return manager.createMonitor( job ); >- } >- >- public IProgressMonitor createMonitor( final Job job, >- final IProgressMonitor group, >- final int ticks ) >- { >- ProgressManager manager = findProgressManager( job ); >- return manager.createMonitor( job, group, ticks ); >- } >- >- public IProgressMonitor createProgressGroup() { >- return defaultProgressManager.createProgressGroup(); >- } >- >- >- /////////////////////////////// >- // interface IJobChangeListener >- >- public void aboutToRun( final IJobChangeEvent event ) { >- ProgressManager manager = findProgressManager( event.getJob() ); >- manager.changeListener.aboutToRun( event ); >- } >- >- public void awake( final IJobChangeEvent event ) { >- ProgressManager manager = findProgressManager( event.getJob() ); >- manager.changeListener.awake( event ); >- } >- >- public void done( final IJobChangeEvent event ) { >- final ProgressManager[] manager = new ProgressManager[ 1 ]; >- Display display = null; >- synchronized( lock ) { >- try { >- manager[ 0 ] = findProgressManager( event.getJob() ); >- display = ( Display )jobs.get( event.getJob() ); >- if( display != null ) { >- display.asyncExec( new Runnable() { >- public void run() { >- Job job = event.getJob(); >- String id = String.valueOf( job.hashCode() ); >- UICallBack.deactivate( id ); >- } >- } ); >- } >- } finally { >- jobs.remove( event.getJob() ); >- } >- } >- if( display != null ) { >- display.asyncExec( new Runnable() { >- public void run() { >- manager[ 0 ].changeListener.done( event ); >- } >- } ); >-// } else { >-// manager[ 0 ].changeListener.done( event ); >- } >- } >- >- public void running( final IJobChangeEvent event ) { >- ProgressManager manager = findProgressManager( event.getJob() ); >- manager.changeListener.running( event ); >- } >- >- public void scheduled( final IJobChangeEvent event ) { >- ProgressManager manager; >- synchronized( lock ) { >- if( ContextProvider.hasContext() ) { >- jobs.put( event.getJob(), RWTLifeCycle.getSessionDisplay() ); >- bindToSession( event.getJob() ); >- String id = String.valueOf( event.getJob().hashCode() ); >- UICallBack.activate( id ); >- } >- manager = findProgressManager( event.getJob() ); >- } >- manager.changeListener.scheduled( event ); >- } >- >- public void sleeping( final IJobChangeEvent event ) { >- ProgressManager manager = findProgressManager( event.getJob() ); >- manager.changeListener.sleeping( event ); >- } >- >- >- ////////////////// >- // helping methods >- >- private ProgressManager findProgressManager( final Job job ) { >- synchronized( lock ) { >- final ProgressManager result[] = new ProgressManager[ 1 ]; >- Display display = ( Display )jobs.get( job ); >- if( display != null ) { >- UICallBack.runNonUIThreadWithFakeContext( display, new Runnable() { >- public void run() { >- result[ 0 ] = ProgressManager.getInstance(); >- } >- } ); >- if( result[ 0 ] == null ) { >- String msg = "ProgressManager must not be null."; >- throw new IllegalStateException( msg ); >- } >- } else { >- result[ 0 ] = defaultProgressManager; >- } >- return result[ 0 ]; >- } >- } >- >- private void bindToSession( final Object keyToRemove ) { >- ISessionStore session = RWT.getSessionStore(); >- HttpSessionBindingListener watchDog = new HttpSessionBindingListener() { >- public void valueBound( final HttpSessionBindingEvent event ) { >- } >- public void valueUnbound( final HttpSessionBindingEvent event ) { >- try { >- handleWatchDog( keyToRemove ); >- } finally { >- synchronized( lock ) { >- jobs.remove( keyToRemove ); >- } >- } >- } >- >- private void handleWatchDog( final Object keyToRemove ) { >- // //////////////////////////////////////////////////////////////////// >- // TODO [fappel]: Very ugly hack to avoid a memory leak. >- // As a job can not be removed from the >- // running set directly, I use reflection. Jobs >- // can be catched in the set on session timeouts. >- // Don't know a proper solution yet. >- // Note that this is still under investigation. >- if( keyToRemove instanceof Job ) { >- final Job jobToRemove = ( Job )keyToRemove; >- Display display = ( Display )jobs.get( jobToRemove ); >- if( display != null ) { >- UICallBack.runNonUIThreadWithFakeContext( display, new Runnable() { >- public void run() { >- jobToRemove.cancel(); >- jobToRemove.addJobChangeListener( new JobCanceler() ); >- } >- } ); >- } >- try { >- IJobManager jobManager = Job.getJobManager(); >- Class clazz = jobManager.getClass(); >- Field running = clazz.getDeclaredField( "running" ); >- running.setAccessible( true ); >- Set set = ( Set )running.get( jobManager ); >- synchronized( lock ) { >- set.remove( keyToRemove ); >- // still sometimes job get catched - use the job marker adapter >- // to check whether they can be eliminated >- Object[] runningJobs = set.toArray(); >- for( int i = 0; i < runningJobs.length; i++ ) { >- Job toCheck = ( Job )runningJobs[ i ]; >- IJobMarker marker >- = ( IJobMarker )toCheck.getAdapter( IJobMarker.class ); >- if( marker != null && marker.canBeRemoved() ) { >- set.remove( toCheck ); >- } >- } >- } >- } catch( final Throwable thr ) { >- // TODO [fappel]: exception handling >- thr.printStackTrace(); >- } >- } >- } >- }; >- session.setAttribute( String.valueOf( watchDog.hashCode() ), watchDog ); >- } >-} >Index: Eclipse UI/org/eclipse/ui/internal/progress/ProgressViewUpdater.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.ui/org.eclipse.rap.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressViewUpdater.java,v >retrieving revision 1.4 >diff -u -r1.4 ProgressViewUpdater.java >--- Eclipse UI/org/eclipse/ui/internal/progress/ProgressViewUpdater.java 29 Apr 2009 13:24:47 -0000 1.4 >+++ Eclipse UI/org/eclipse/ui/internal/progress/ProgressViewUpdater.java 11 Sep 2009 08:35:40 -0000 >@@ -17,6 +17,8 @@ > > import org.eclipse.core.runtime.*; > import org.eclipse.core.runtime.jobs.Job; >+import org.eclipse.rap.ui.internal.progress.JobCanceler; >+import org.eclipse.rap.ui.internal.progress.ProgressUtil; > import org.eclipse.rwt.RWT; > import org.eclipse.rwt.SessionSingletonBase; > import org.eclipse.rwt.internal.lifecycle.RWTLifeCycle; >Index: Eclipse UI/org/eclipse/ui/internal/progress/ProgressAnimationItem.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.ui/org.eclipse.rap.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressAnimationItem.java,v >retrieving revision 1.2 >diff -u -r1.2 ProgressAnimationItem.java >--- Eclipse UI/org/eclipse/ui/internal/progress/ProgressAnimationItem.java 23 Apr 2008 15:02:15 -0000 1.2 >+++ Eclipse UI/org/eclipse/ui/internal/progress/ProgressAnimationItem.java 11 Sep 2009 08:35:39 -0000 >@@ -14,6 +14,7 @@ > import org.eclipse.core.runtime.jobs.Job; > import org.eclipse.jface.action.IAction; > import org.eclipse.osgi.util.NLS; >+import org.eclipse.rap.ui.internal.progress.ProgressUtil; > import org.eclipse.swt.SWT; > import org.eclipse.swt.events.*; > import org.eclipse.swt.graphics.Image; >Index: Eclipse UI/org/eclipse/ui/internal/progress/ProgressMonitorJobsDialog.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.ui/org.eclipse.rap.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressMonitorJobsDialog.java,v >retrieving revision 1.4 >diff -u -r1.4 ProgressMonitorJobsDialog.java >--- Eclipse UI/org/eclipse/ui/internal/progress/ProgressMonitorJobsDialog.java 27 May 2009 09:26:12 -0000 1.4 >+++ Eclipse UI/org/eclipse/ui/internal/progress/ProgressMonitorJobsDialog.java 11 Sep 2009 08:35:40 -0000 >@@ -18,6 +18,7 @@ > import org.eclipse.jface.operation.IRunnableWithProgress; > import org.eclipse.jface.viewers.Viewer; > import org.eclipse.jface.viewers.ViewerComparator; >+import org.eclipse.rap.ui.internal.progress.ProgressUtil; > import org.eclipse.rwt.graphics.Graphics; > import org.eclipse.swt.SWT; > import org.eclipse.swt.events.SelectionAdapter; >Index: Eclipse UI/org/eclipse/ui/internal/progress/ProgressManager.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.ui/org.eclipse.rap.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressManager.java,v >retrieving revision 1.5 >diff -u -r1.5 ProgressManager.java >--- Eclipse UI/org/eclipse/ui/internal/progress/ProgressManager.java 2 Jun 2008 08:49:11 -0000 1.5 >+++ Eclipse UI/org/eclipse/ui/internal/progress/ProgressManager.java 11 Sep 2009 08:35:40 -0000 >@@ -24,6 +24,7 @@ > import org.eclipse.jface.operation.IRunnableContext; > import org.eclipse.jface.operation.IRunnableWithProgress; > import org.eclipse.jface.resource.*; >+import org.eclipse.rap.ui.internal.progress.ProgressUtil; > import org.eclipse.rwt.SessionSingletonBase; > import org.eclipse.swt.custom.BusyIndicator; > import org.eclipse.swt.graphics.Image; >@@ -98,7 +99,8 @@ > > final Object listenersKey = new Object(); > >- IJobChangeListener changeListener; >+ // RAP [bm]: made public to access in org.eclipse.rap.ui.* >+ public IJobChangeListener changeListener; > > static final String PROGRESS_VIEW_NAME = "org.eclipse.ui.views.ProgressView"; //$NON-NLS-1$ > >@@ -360,7 +362,8 @@ > /** > * Create a new instance of the receiver. > */ >- ProgressManager() { >+ // RAP [bm]: made public to access in org.eclipse.rap.ui.* >+ public ProgressManager() { > // RAP [fappel]: > // Job.getJobManager().setProgressProvider(this); > // Dialog.setBlockedHandler(new WorkbenchDialogBlockedHandler()); >Index: Eclipse UI/org/eclipse/ui/internal/progress/AnimationManager.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.ui/org.eclipse.rap.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/AnimationManager.java,v >retrieving revision 1.3 >diff -u -r1.3 AnimationManager.java >--- Eclipse UI/org/eclipse/ui/internal/progress/AnimationManager.java 29 Jun 2009 16:49:32 -0000 1.3 >+++ Eclipse UI/org/eclipse/ui/internal/progress/AnimationManager.java 11 Sep 2009 08:35:39 -0000 >@@ -17,6 +17,8 @@ > > import org.eclipse.core.runtime.*; > import org.eclipse.core.runtime.jobs.Job; >+import org.eclipse.rap.ui.internal.progress.IJobMarker; >+import org.eclipse.rap.ui.internal.progress.JobCanceler; > import org.eclipse.rwt.RWT; > import org.eclipse.rwt.SessionSingletonBase; > import org.eclipse.rwt.lifecycle.UICallBack; >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.ui/org.eclipse.rap.ui.workbench/META-INF/MANIFEST.MF,v >retrieving revision 1.17 >diff -u -r1.17 MANIFEST.MF >--- META-INF/MANIFEST.MF 10 Sep 2009 11:50:15 -0000 1.17 >+++ META-INF/MANIFEST.MF 11 Sep 2009 08:35:40 -0000 >@@ -15,7 +15,10 @@ > org.eclipse.rap.ui.interactiondesign.internal;x-friends:="org.eclipse.rap.ui.tests", > org.eclipse.rap.ui.interactiondesign.layout, > org.eclipse.rap.ui.interactiondesign.layout.model, >+ org.eclipse.rap.ui.internal;x-internal:=true, > org.eclipse.rap.ui.internal.branding;x-internal:=true, >+ org.eclipse.rap.ui.internal.preferences;x-internal:=true, >+ org.eclipse.rap.ui.internal.progress;x-internal:=true, > org.eclipse.rap.ui.internal.servlet;x-internal:=true, > org.eclipse.ui;ui.workbench=split;mandatory:="ui.workbench", > org.eclipse.ui.about, >Index: Eclipse UI/org/eclipse/ui/progress/DeferredTreeContentManager.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.ui/org.eclipse.rap.ui.workbench/Eclipse UI/org/eclipse/ui/progress/DeferredTreeContentManager.java,v >retrieving revision 1.2 >diff -u -r1.2 DeferredTreeContentManager.java >--- Eclipse UI/org/eclipse/ui/progress/DeferredTreeContentManager.java 23 Apr 2008 15:02:15 -0000 1.2 >+++ Eclipse UI/org/eclipse/ui/progress/DeferredTreeContentManager.java 11 Sep 2009 08:35:40 -0000 >@@ -15,11 +15,11 @@ > import org.eclipse.jface.viewers.AbstractTreeViewer; > import org.eclipse.jface.viewers.ITreeContentProvider; > import org.eclipse.osgi.util.NLS; >+import org.eclipse.rap.ui.internal.progress.ProgressUtil; > import org.eclipse.swt.widgets.Control; > import org.eclipse.swt.widgets.Display; > import org.eclipse.ui.IWorkbenchPartSite; > import org.eclipse.ui.internal.progress.ProgressMessages; >-import org.eclipse.ui.internal.progress.ProgressUtil; > import org.eclipse.ui.internal.util.Util; > import org.eclipse.ui.model.IWorkbenchAdapter; > >Index: Eclipse UI/org/eclipse/ui/progress/WorkbenchJob.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.ui/org.eclipse.rap.ui.workbench/Eclipse UI/org/eclipse/ui/progress/WorkbenchJob.java,v >retrieving revision 1.3 >diff -u -r1.3 WorkbenchJob.java >--- Eclipse UI/org/eclipse/ui/progress/WorkbenchJob.java 25 Apr 2008 16:24:47 -0000 1.3 >+++ Eclipse UI/org/eclipse/ui/progress/WorkbenchJob.java 11 Sep 2009 08:35:40 -0000 >@@ -13,8 +13,8 @@ > import org.eclipse.core.runtime.IStatus; > import org.eclipse.core.runtime.jobs.IJobChangeEvent; > import org.eclipse.core.runtime.jobs.JobChangeAdapter; >+import org.eclipse.rap.ui.internal.progress.ProgressUtil; > import org.eclipse.swt.widgets.Display; >-import org.eclipse.ui.internal.progress.ProgressUtil; > > /** > * WorkbenchJob is a type of job that implements a done listener >Index: Eclipse UI/org/eclipse/ui/internal/util/SessionSingletonEventManager.java >=================================================================== >RCS file: Eclipse UI/org/eclipse/ui/internal/util/SessionSingletonEventManager.java >diff -N Eclipse UI/org/eclipse/ui/internal/util/SessionSingletonEventManager.java >--- Eclipse UI/org/eclipse/ui/internal/util/SessionSingletonEventManager.java 12 Jun 2008 16:29:53 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,75 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2002, 2008 Innoopract Informationssysteme GmbH. >- * 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >- >-package org.eclipse.ui.internal.util; >- >-import org.eclipse.core.commands.common.EventManager; >-import org.eclipse.rwt.SessionSingletonBase; >- >- >-public class SessionSingletonEventManager extends SessionSingletonBase { >- >- /* >- * As Workbench needs to inherit from EventManager AND SessionSingleton >- * we introduced a new layer in between to fake the methods. >- * As EventManager is abstract and has final methods, we use methodE() >- * to delegate to the original >- */ >- private final class EventManagerExtension extends EventManager { >- public synchronized final void addListenerObjectE(final Object listener) { >- addListenerObject( listener ); >- } >- >- public synchronized final void clearListenersE() { >- clearListeners(); >- } >- >- public final Object[] getListenersE() { >- return getListeners(); >- } >- >- public final boolean isListenerAttachedE() { >- return isListenerAttached(); >- } >- >- public synchronized final void removeListenerObjectE(final Object listener) { >- removeListenerObject( listener ); >- } >- } >- >- private EventManagerExtension manager; >- >- public SessionSingletonEventManager() { >- >- manager = new EventManagerExtension(); >- } >- >- protected synchronized final void addListenerObject(final Object listener) { >- manager.addListenerObjectE( listener ); >- } >- >- protected synchronized final void clearListeners() { >- manager.clearListenersE(); >- } >- >- protected final Object[] getListeners() { >- return manager.getListenersE(); >- } >- >- protected final boolean isListenerAttached() { >- return manager.isListenerAttachedE(); >- } >- >- protected synchronized final void removeListenerObject(final Object listener) { >- manager.removeListenerObjectE( listener ); >- } >- >-} >Index: Eclipse UI/org/eclipse/ui/internal/themes/WorkbenchThemeManager.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.ui/org.eclipse.rap.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/WorkbenchThemeManager.java,v >retrieving revision 1.6 >diff -u -r1.6 WorkbenchThemeManager.java >--- Eclipse UI/org/eclipse/ui/internal/themes/WorkbenchThemeManager.java 1 Apr 2009 08:20:03 -0000 1.6 >+++ Eclipse UI/org/eclipse/ui/internal/themes/WorkbenchThemeManager.java 11 Sep 2009 08:35:40 -0000 >@@ -19,6 +19,7 @@ > import org.eclipse.jface.resource.JFaceResources; > import org.eclipse.jface.util.IPropertyChangeListener; > import org.eclipse.jface.util.PropertyChangeEvent; >+import org.eclipse.rap.ui.internal.SessionSingletonEventManager; > import org.eclipse.swt.graphics.FontData; > import org.eclipse.swt.graphics.RGB; > import org.eclipse.ui.IWorkbenchPreferenceConstants; >@@ -26,7 +27,6 @@ > import org.eclipse.ui.internal.WorkbenchPlugin; > import org.eclipse.ui.internal.misc.StatusUtil; > import org.eclipse.ui.internal.util.PrefUtil; >-import org.eclipse.ui.internal.util.SessionSingletonEventManager; > import org.eclipse.ui.statushandlers.StatusManager; > import org.eclipse.ui.themes.ITheme; > import org.eclipse.ui.themes.IThemeManager; >Index: Eclipse UI/org/eclipse/ui/internal/registry/EditorRegistry.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.ui/org.eclipse.rap.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/EditorRegistry.java,v >retrieving revision 1.4 >diff -u -r1.4 EditorRegistry.java >--- Eclipse UI/org/eclipse/ui/internal/registry/EditorRegistry.java 23 Apr 2008 13:09:11 -0000 1.4 >+++ Eclipse UI/org/eclipse/ui/internal/registry/EditorRegistry.java 11 Sep 2009 08:35:40 -0000 >@@ -44,6 +44,7 @@ > import org.eclipse.jface.preference.IPreferenceStore; > import org.eclipse.jface.resource.ImageDescriptor; > import org.eclipse.jface.util.SafeRunnable; >+import org.eclipse.rap.ui.internal.SessionSingletonEventManager; > import org.eclipse.swt.widgets.Shell; > import org.eclipse.ui.IEditorDescriptor; > import org.eclipse.ui.IEditorRegistry; >@@ -62,7 +63,6 @@ > import org.eclipse.ui.internal.WorkbenchMessages; > import org.eclipse.ui.internal.WorkbenchPlugin; > import org.eclipse.ui.internal.editorsupport.ComponentSupport; >-import org.eclipse.ui.internal.util.SessionSingletonEventManager; > import org.eclipse.ui.internal.util.Util; > > import com.ibm.icu.text.Collator; >Index: Eclipse UI/org/eclipse/rap/ui/internal/servlet/EngineConfigWrapper.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.ui/org.eclipse.rap.ui.workbench/Eclipse UI/org/eclipse/rap/ui/internal/servlet/EngineConfigWrapper.java,v >retrieving revision 1.4 >diff -u -r1.4 EngineConfigWrapper.java >--- Eclipse UI/org/eclipse/rap/ui/internal/servlet/EngineConfigWrapper.java 4 Jun 2009 11:45:27 -0000 1.4 >+++ Eclipse UI/org/eclipse/rap/ui/internal/servlet/EngineConfigWrapper.java 11 Sep 2009 08:35:39 -0000 >@@ -17,6 +17,7 @@ > import java.text.MessageFormat; > > import org.eclipse.core.runtime.*; >+import org.eclipse.rap.ui.internal.preferences.WorkbenchFileSettingStoreFactory; > import org.eclipse.rwt.internal.*; > import org.eclipse.rwt.internal.engine.RWTServletContextListener; > import org.eclipse.rwt.internal.lifecycle.*; >@@ -30,7 +31,6 @@ > import org.eclipse.rwt.service.ISettingStoreFactory; > import org.eclipse.ui.PlatformUI; > import org.eclipse.ui.internal.WorkbenchPlugin; >-import org.eclipse.ui.internal.preferences.WorkbenchFileSettingStoreFactory; > import org.osgi.framework.Bundle; > > >Index: Eclipse UI/org/eclipse/rap/ui/internal/preferences/SessionPreferenceNodeCore.java >=================================================================== >RCS file: Eclipse UI/org/eclipse/rap/ui/internal/preferences/SessionPreferenceNodeCore.java >diff -N Eclipse UI/org/eclipse/rap/ui/internal/preferences/SessionPreferenceNodeCore.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI/org/eclipse/rap/ui/internal/preferences/SessionPreferenceNodeCore.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,183 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 Innoopract Informationssysteme GmbH. >+ * 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: >+ * Innoopract Informationssysteme GmbH - initial API and implementation >+ ******************************************************************************/ >+package org.eclipse.rap.ui.internal.preferences; >+ >+import org.eclipse.core.runtime.*; >+import org.eclipse.core.runtime.preferences.IEclipsePreferences.*; >+import org.eclipse.rwt.RWT; >+import org.eclipse.rwt.internal.util.ParamCheck; >+import org.eclipse.rwt.service.*; >+import org.eclipse.ui.internal.WorkbenchPlugin; >+import org.osgi.service.prefs.Preferences; >+ >+/** >+ * This class is the link between the SessionPreferenceNode hierarchy >+ * (application global) the RWT setting store (session specific). >+ */ >+final class SessionPreferenceNodeCore { >+ >+ private final SessionPreferencesNode node; >+ private ListenerList prefListeners; // ListenerList is thread safe >+ private final ListenerList nodeListeners >+ = new ListenerList( ListenerList.IDENTITY ); // thread safe >+ >+ >+ /* tracks changes in RWT setting store and notifies the prefListeners */ >+ private SettingStoreListener rwtListener; >+ /* true to track RWT changes */ >+ private boolean trackChanges = true; >+ /* ignore changes to this key for a short time */ >+ private String ignoreKey; >+ >+ SessionPreferenceNodeCore( final SessionPreferencesNode node ) { >+ ParamCheck.notNull( node, "node" ); //$NON-NLS-1$ >+ this.node = node; >+ } >+ >+ void addPreferenceChangeListener( IPreferenceChangeListener listener ) { >+ if( listener != null ) { >+ getListenerList().add( listener ); >+ setTrackRWTChanges( true ); >+ } >+ } >+ >+ void removePreferenceChangeListener( IPreferenceChangeListener listener ) { >+ if( listener != null ) { >+ ListenerList list = getListenerList(); >+ list.remove( listener ); >+ if( list.isEmpty() ) { >+ setTrackRWTChanges( false ); >+ } >+ } >+ } >+ >+ void firePreferenceEvent( final String key, >+ final String oldValue, >+ final String newValue ) >+ { >+ if( prefListeners != null ) { >+ final PreferenceChangeEvent event >+ = new PreferenceChangeEvent( node, key, oldValue, newValue ); >+ Object[] listeners = prefListeners.getListeners(); >+ for( int i = 0; i < listeners.length; i++ ) { >+ final IPreferenceChangeListener listener >+ = ( IPreferenceChangeListener )listeners[ i ]; >+ ISafeRunnable op = new ISafeRunnable() { >+ public void handleException( final Throwable exception ) { >+ // logged by SafeRunner >+ } >+ public void run() throws Exception { >+ listener.preferenceChange( event ); >+ } >+ }; >+ SafeRunner.run( op ); >+ } >+ } >+ } >+ >+ void clear() { >+ if( prefListeners != null ) { >+ prefListeners.clear(); >+ prefListeners = null; >+ setTrackRWTChanges( false ); >+ } >+ nodeListeners.clear(); >+ } >+ >+ synchronized String put( final String uniqueKey, >+ final String value ) { >+ ISettingStore store = RWT.getSettingStore(); >+ String result = store.getAttribute( uniqueKey ); >+ try { >+ ignoreKey = uniqueKey; >+ store.setAttribute( uniqueKey, value ); >+ ignoreKey = null; >+ } catch( SettingStoreException exc ) { >+ String msg = "Could not persist preference: " + uniqueKey; //$NON-NLS-1$ >+ WorkbenchPlugin.log( msg, exc ); >+ } >+ return result; >+ } >+ >+ // helping methods >+ ////////////////// >+ >+ private synchronized ListenerList getListenerList() { >+ if( prefListeners == null ) { >+ prefListeners = new ListenerList( ListenerList.IDENTITY ); >+ } >+ return prefListeners; >+ } >+ >+ private synchronized void setTrackRWTChanges( final boolean doTrack ) { >+ this.trackChanges = doTrack; >+ if( trackChanges ) { >+ if( rwtListener == null ) { >+ rwtListener = new SettingStoreListener() { >+ public void settingChanged( SettingStoreEvent event ) { >+ if( trackChanges ) { >+ String fullKey = event.getAttributeName(); >+ if( !fullKey.equals( ignoreKey ) ) { >+ String absPath = node.absolutePath(); >+ if( fullKey.startsWith( absPath ) ) { >+ String key = fullKey.substring( absPath.length() + 1 ); >+ String oldValue = event.getOldValue(); >+ String newValue = event.getNewValue(); >+ firePreferenceEvent( key, oldValue, newValue ); >+ } >+ } >+ } >+ } >+ }; >+ } >+ RWT.getSettingStore().addSettingStoreListener( rwtListener ); >+ } else { // !trackChanges >+ if( rwtListener != null ) { >+ RWT.getSettingStore().removeSettingStoreListener( rwtListener ); >+ } >+ } >+ } >+ >+ public void addNodeChangeListener( final INodeChangeListener listener ) { >+ nodeListeners.add( listener ); >+ } >+ >+ public void removeNodeChangeListener( final INodeChangeListener listener ) { >+ nodeListeners.remove( listener ); >+ } >+ >+ public void fireNodeEvent( final Preferences child, >+ final boolean wasAdded, >+ final SessionPreferencesNode spn ) >+ { >+ final NodeChangeEvent event = new NodeChangeEvent( spn, child ); >+ Object[] listeners = nodeListeners.getListeners(); >+ for( int i = 0; i < listeners.length; i++ ) { >+ final INodeChangeListener listener >+ = ( INodeChangeListener )listeners[ i ]; >+ ISafeRunnable op = new ISafeRunnable() { >+ public void handleException( final Throwable exception ) { >+ // logged by SafeRunner >+ } >+ public void run() throws Exception { >+ if( wasAdded ) { >+ listener.added( event ); >+ } else { >+ listener.removed( event ); >+ } >+ } >+ }; >+ SafeRunner.run( op ); >+ } >+ >+ } >+ >+} >Index: Eclipse UI/org/eclipse/rap/ui/internal/preferences/SessionScope.java >=================================================================== >RCS file: Eclipse UI/org/eclipse/rap/ui/internal/preferences/SessionScope.java >diff -N Eclipse UI/org/eclipse/rap/ui/internal/preferences/SessionScope.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI/org/eclipse/rap/ui/internal/preferences/SessionScope.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,70 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 Innoopract Informationssysteme GmbH. >+ * 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: >+ * Innoopract Informationssysteme GmbH - initial API and implementation >+ ******************************************************************************/ >+package org.eclipse.rap.ui.internal.preferences; >+ >+import org.eclipse.core.runtime.IPath; >+import org.eclipse.core.runtime.Platform; >+import org.eclipse.core.runtime.preferences.IEclipsePreferences; >+import org.eclipse.core.runtime.preferences.IScopeContext; >+import org.eclipse.rwt.RWT; >+import org.eclipse.rwt.internal.util.ParamCheck; >+import org.eclipse.rwt.service.FileSettingStore; >+ >+// TODO [fappel]: think about how we can provide this as API (subset rule >+// of RAP/RCP) >+/** >+ * Object representing the session scope in the Eclipse preferences >+ * hierarchy. Can be used as a context for searching for preference >+ * values (in the IPreferenceService APIs) or for determining the >+ * corrent preference node to set values in the store. >+ * <p> >+ * Session preferences are stored on a <i>per-session</i> basis using >+ * the underlying RWT SettingStore (see {@link RWT#getSettingStore()}. >+ * Preferences saved during a previous session will be retrieved, as long as >+ * the user can identify himself with the setting store cookie. Session >+ * preferences are persisted using the setting store implementation >+ * that is configured for the application (see {@link FileSettingStore}. >+ * <p> >+ * The path for preferences defined in the session scope hierarchy is: >+ * <code>/session/<qualifier></code> >+ * <p> >+ * This class is not intented to be subclassed. It may be instantiated. >+ * >+ */ >+public final class SessionScope implements IScopeContext { >+ >+ /** >+ * String constant (value of <code>"session"</code>) used for the >+ * scope name for the session preference scope. >+ */ >+ public static final String SCOPE = "session"; //$NON-NLS-1$ >+ >+ /** >+ * Create and return a new session scope instance. >+ */ >+ public SessionScope() { >+ super(); >+ } >+ >+ public IPath getLocation() { >+ return null; >+ } >+ >+ public String getName() { >+ return SCOPE; >+ } >+ >+ public IEclipsePreferences getNode( String qualifier ) { >+ ParamCheck.notNull( qualifier, "qualifier" ); //$NON-NLS-1$ >+ IEclipsePreferences root = Platform.getPreferencesService().getRootNode(); >+ return ( IEclipsePreferences ) root.node( SCOPE ).node( qualifier ); >+ } >+} >Index: Eclipse UI/org/eclipse/rap/ui/internal/progress/IJobMarker.java >=================================================================== >RCS file: Eclipse UI/org/eclipse/rap/ui/internal/progress/IJobMarker.java >diff -N Eclipse UI/org/eclipse/rap/ui/internal/progress/IJobMarker.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI/org/eclipse/rap/ui/internal/progress/IJobMarker.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,20 @@ >+/******************************************************************************* >+ * Copyright (c) 2002, 2008 Innoopract Informationssysteme GmbH. >+ * 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: >+ * Innoopract Informationssysteme GmbH - initial API and implementation >+ ******************************************************************************/ >+ >+package org.eclipse.rap.ui.internal.progress; >+ >+// RAP [fappel]: This is a helper class used to avoid a memory leak due to >+// thread management. >+// Note that this is still under investigation. >+// See comment in JobManagerAdapter >+public interface IJobMarker { >+ boolean canBeRemoved(); >+} >Index: Eclipse UI/org/eclipse/rap/ui/internal/progress/ProgressUtil.java >=================================================================== >RCS file: Eclipse UI/org/eclipse/rap/ui/internal/progress/ProgressUtil.java >diff -N Eclipse UI/org/eclipse/rap/ui/internal/progress/ProgressUtil.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI/org/eclipse/rap/ui/internal/progress/ProgressUtil.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,34 @@ >+/******************************************************************************* >+ * Copyright (c) 2002, 2008 Innoopract Informationssysteme GmbH. >+ * 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: >+ * Innoopract Informationssysteme GmbH - initial API and implementation >+ ******************************************************************************/ >+ >+package org.eclipse.rap.ui.internal.progress; >+ >+import org.eclipse.rwt.lifecycle.UICallBack; >+import org.eclipse.swt.widgets.Display; >+import org.eclipse.ui.PlatformUI; >+ >+// RAP [fappel]: >+public final class ProgressUtil { >+ >+ private ProgressUtil() { >+ // prevent instance creation >+ } >+ >+ public static boolean isWorkbenchRunning( final Display display ) { >+ final boolean[] result = new boolean[ 1 ]; >+ UICallBack.runNonUIThreadWithFakeContext( display, new Runnable() { >+ public void run() { >+ result[ 0 ] = PlatformUI.isWorkbenchRunning(); >+ } >+ } ); >+ return result[ 0 ]; >+ } >+} >Index: Eclipse UI/org/eclipse/rap/ui/internal/progress/JobCanceler.java >=================================================================== >RCS file: Eclipse UI/org/eclipse/rap/ui/internal/progress/JobCanceler.java >diff -N Eclipse UI/org/eclipse/rap/ui/internal/progress/JobCanceler.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI/org/eclipse/rap/ui/internal/progress/JobCanceler.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,46 @@ >+/******************************************************************************* >+ * Copyright (c) 2002-2006 Innoopract Informationssysteme GmbH. >+ * 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: >+ * Innoopract Informationssysteme GmbH - initial API and implementation >+ ******************************************************************************/ >+ >+package org.eclipse.rap.ui.internal.progress; >+ >+import org.eclipse.core.runtime.jobs.IJobChangeEvent; >+import org.eclipse.core.runtime.jobs.IJobChangeListener; >+ >+// RAP [fappel]: This is a helper class used to avoid a memory leak due to >+// thread management. >+// Note that this is still under investigation. >+// See comment in JobManagerAdapter >+public final class JobCanceler implements IJobChangeListener { >+ >+ public void aboutToRun( IJobChangeEvent event ) { >+ event.getJob().cancel(); >+ } >+ >+ public void awake( IJobChangeEvent event ) { >+ event.getJob().cancel(); >+ } >+ >+ public void done( IJobChangeEvent event ) { >+ event.getJob().cancel(); >+ } >+ >+ public void running( IJobChangeEvent event ) { >+ event.getJob().cancel(); >+ } >+ >+ public void scheduled( IJobChangeEvent event ) { >+ event.getJob().cancel(); >+ } >+ >+ public void sleeping( IJobChangeEvent event ) { >+ event.getJob().cancel(); >+ } >+} >\ No newline at end of file >Index: Eclipse UI/org/eclipse/rap/ui/internal/preferences/SessionPreferencesFactory.java >=================================================================== >RCS file: Eclipse UI/org/eclipse/rap/ui/internal/preferences/SessionPreferencesFactory.java >diff -N Eclipse UI/org/eclipse/rap/ui/internal/preferences/SessionPreferencesFactory.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI/org/eclipse/rap/ui/internal/preferences/SessionPreferencesFactory.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,27 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 Innoopract Informationssysteme GmbH. >+ * 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: >+ * Innoopract Informationssysteme GmbH - initial API and implementation >+ ******************************************************************************/ >+package org.eclipse.rap.ui.internal.preferences; >+ >+import org.eclipse.core.runtime.preferences.IEclipsePreferences; >+import org.eclipse.core.runtime.preferences.IScope; >+ >+/** >+ * Creates "session" scoped preference nodes. >+ */ >+public final class SessionPreferencesFactory implements IScope { >+ >+ public IEclipsePreferences create( final IEclipsePreferences parent, >+ final String name ) >+ { >+ return new SessionPreferencesNode( parent, name ); >+ } >+ >+} >Index: Eclipse UI/org/eclipse/rap/ui/internal/preferences/WorkbenchFileSettingStoreFactory.java >=================================================================== >RCS file: Eclipse UI/org/eclipse/rap/ui/internal/preferences/WorkbenchFileSettingStoreFactory.java >diff -N Eclipse UI/org/eclipse/rap/ui/internal/preferences/WorkbenchFileSettingStoreFactory.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI/org/eclipse/rap/ui/internal/preferences/WorkbenchFileSettingStoreFactory.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,85 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 Innoopract Informationssysteme GmbH. >+ * 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: >+ * Innoopract Informationssysteme GmbH - initial API and implementation >+ ******************************************************************************/ >+package org.eclipse.rap.ui.internal.preferences; >+ >+ >+import java.io.File; >+ >+import org.eclipse.core.runtime.IPath; >+import org.eclipse.core.runtime.Platform; >+import org.eclipse.rwt.RWT; >+import org.eclipse.rwt.internal.util.ParamCheck; >+import org.eclipse.rwt.service.*; >+import org.eclipse.ui.PlatformUI; >+import org.osgi.framework.Bundle; >+ >+ >+/** >+ * {@link ISettingStoreFactory} that creates {@link FileSettingStore} >+ * instances. >+ * <p> >+ * This particular implementation uses the following strategy to determine >+ * the path for persisting the data of a FileSettingStore: >+ * <ol> >+ * <li>Use the directory specified by the system property >+ * <code>"org.eclipse.rwt.service.FileSettingStore.dir"</code>. >+ * </li> >+ * <li>Use a subdirectory in the state location of the >+ * org.eclipse.rap.ui.workbench bundle. >+ * </li> >+ * </ol> >+ * The first path that can be obtained from the above choices (in the order >+ * given above) will be used. If the path determined does not exist it will >+ * be created. >+ * <p> >+ * <b>Note:</b> This setting store factory should be used in a regular >+ * RAP deployment. For an RWT only deployment use the >+ * {@link RWTFileSettingStoreFactory}. >+ * >+ */ >+public final class WorkbenchFileSettingStoreFactory >+ implements ISettingStoreFactory >+{ >+ >+ public ISettingStore createSettingStore( final String storeId ) { >+ ParamCheck.notNullOrEmpty( storeId, "storeId" ); //$NON-NLS-1$ >+ ISettingStore result = new FileSettingStore( getWorkDir() ); >+ try { >+ result.loadById( storeId ); >+ } catch( SettingStoreException sse ) { >+ String msg = String.valueOf( sse.getMessage() ); >+ RWT.getRequest().getSession().getServletContext().log( msg, sse ); >+ } >+ return result; >+ } >+ >+ ////////////////// >+ // helping methods >+ >+ private File getWorkDir() { >+ File result = getWorkDirFromEnvironment(); >+ if( result == null ) { >+ Bundle bundle = Platform.getBundle( PlatformUI.PLUGIN_ID ); >+ IPath stateLoc = Platform.getStateLocation( bundle ); >+ File parentDir = stateLoc.toFile(); >+ result = new File( parentDir, FileSettingStore.class.getName() ); >+ } >+ if( !result.exists() ) { >+ result.mkdirs(); >+ } >+ return result; >+ } >+ >+ private File getWorkDirFromEnvironment() { >+ String path = System.getProperty( FileSettingStore.FILE_SETTING_STORE_DIR ); >+ return ( path != null ) ? new File( path ) : null; >+ } >+} >Index: Eclipse UI/org/eclipse/rap/ui/internal/progress/JobManagerAdapter.java >=================================================================== >RCS file: Eclipse UI/org/eclipse/rap/ui/internal/progress/JobManagerAdapter.java >diff -N Eclipse UI/org/eclipse/rap/ui/internal/progress/JobManagerAdapter.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI/org/eclipse/rap/ui/internal/progress/JobManagerAdapter.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,245 @@ >+/******************************************************************************* >+ * Copyright (c) 2007, 2008 Innoopract Informationssysteme GmbH. >+ * 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: >+ * Innoopract Informationssysteme GmbH - initial API and implementation >+ ******************************************************************************/ >+package org.eclipse.rap.ui.internal.progress; >+ >+import java.lang.reflect.Field; >+import java.util.*; >+ >+import javax.servlet.http.HttpSessionBindingEvent; >+import javax.servlet.http.HttpSessionBindingListener; >+ >+import org.eclipse.core.runtime.IProgressMonitor; >+import org.eclipse.core.runtime.jobs.*; >+import org.eclipse.rwt.RWT; >+import org.eclipse.rwt.internal.lifecycle.RWTLifeCycle; >+import org.eclipse.rwt.internal.service.ContextProvider; >+import org.eclipse.rwt.lifecycle.UICallBack; >+import org.eclipse.rwt.service.ISessionStore; >+import org.eclipse.swt.widgets.Display; >+import org.eclipse.ui.internal.progress.ProgressManager; >+ >+// RAP [fappel]: >+public class JobManagerAdapter >+ extends ProgressProvider >+ implements IJobChangeListener >+{ >+ >+ private static JobManagerAdapter _instance; >+ private final Map jobs; >+ private final ProgressManager defaultProgressManager; >+ final Object lock; >+ >+ public static synchronized JobManagerAdapter getInstance() { >+ if( _instance == null ) { >+ _instance = new JobManagerAdapter(); >+ } >+ return _instance; >+ } >+ >+ >+ private JobManagerAdapter() { >+ // To avoid deadlocks we have to use the same synchronisation lock. >+ // If anyone has a better idea - you're welcome. >+ IJobManager jobManager = Job.getJobManager(); >+ Class clazz = jobManager.getClass(); >+ try { >+ Field jobManagerLock = clazz.getDeclaredField( "lock" ); >+ jobManagerLock.setAccessible( true ); >+ lock = jobManagerLock.get( jobManager ); >+ } catch( final Throwable thr ) { >+ String msg = "Could not initialize synchronization lock."; >+ throw new IllegalStateException( msg ); >+ } >+ jobs = new HashMap(); >+ defaultProgressManager = new ProgressManager(); >+ Job.getJobManager().setProgressProvider( this ); >+ Job.getJobManager().addJobChangeListener( this ); >+ } >+ >+ >+ /////////////////////////////// >+ // ProgressProvider >+ >+ public IProgressMonitor createMonitor( final Job job ) { >+ ProgressManager manager = findProgressManager( job ); >+ return manager.createMonitor( job ); >+ } >+ >+ public IProgressMonitor createMonitor( final Job job, >+ final IProgressMonitor group, >+ final int ticks ) >+ { >+ ProgressManager manager = findProgressManager( job ); >+ return manager.createMonitor( job, group, ticks ); >+ } >+ >+ public IProgressMonitor createProgressGroup() { >+ return defaultProgressManager.createProgressGroup(); >+ } >+ >+ >+ /////////////////////////////// >+ // interface IJobChangeListener >+ >+ public void aboutToRun( final IJobChangeEvent event ) { >+ ProgressManager manager = findProgressManager( event.getJob() ); >+ manager.changeListener.aboutToRun( event ); >+ } >+ >+ public void awake( final IJobChangeEvent event ) { >+ ProgressManager manager = findProgressManager( event.getJob() ); >+ manager.changeListener.awake( event ); >+ } >+ >+ public void done( final IJobChangeEvent event ) { >+ final ProgressManager[] manager = new ProgressManager[ 1 ]; >+ Display display = null; >+ synchronized( lock ) { >+ try { >+ manager[ 0 ] = findProgressManager( event.getJob() ); >+ display = ( Display )jobs.get( event.getJob() ); >+ if( display != null ) { >+ display.asyncExec( new Runnable() { >+ public void run() { >+ Job job = event.getJob(); >+ String id = String.valueOf( job.hashCode() ); >+ UICallBack.deactivate( id ); >+ } >+ } ); >+ } >+ } finally { >+ jobs.remove( event.getJob() ); >+ } >+ } >+ if( display != null ) { >+ display.asyncExec( new Runnable() { >+ public void run() { >+ manager[ 0 ].changeListener.done( event ); >+ } >+ } ); >+// } else { >+// manager[ 0 ].changeListener.done( event ); >+ } >+ } >+ >+ public void running( final IJobChangeEvent event ) { >+ ProgressManager manager = findProgressManager( event.getJob() ); >+ manager.changeListener.running( event ); >+ } >+ >+ public void scheduled( final IJobChangeEvent event ) { >+ ProgressManager manager; >+ synchronized( lock ) { >+ if( ContextProvider.hasContext() ) { >+ jobs.put( event.getJob(), RWTLifeCycle.getSessionDisplay() ); >+ bindToSession( event.getJob() ); >+ String id = String.valueOf( event.getJob().hashCode() ); >+ UICallBack.activate( id ); >+ } >+ manager = findProgressManager( event.getJob() ); >+ } >+ manager.changeListener.scheduled( event ); >+ } >+ >+ public void sleeping( final IJobChangeEvent event ) { >+ ProgressManager manager = findProgressManager( event.getJob() ); >+ manager.changeListener.sleeping( event ); >+ } >+ >+ >+ ////////////////// >+ // helping methods >+ >+ private ProgressManager findProgressManager( final Job job ) { >+ synchronized( lock ) { >+ final ProgressManager result[] = new ProgressManager[ 1 ]; >+ Display display = ( Display )jobs.get( job ); >+ if( display != null ) { >+ UICallBack.runNonUIThreadWithFakeContext( display, new Runnable() { >+ public void run() { >+ result[ 0 ] = ProgressManager.getInstance(); >+ } >+ } ); >+ if( result[ 0 ] == null ) { >+ String msg = "ProgressManager must not be null."; >+ throw new IllegalStateException( msg ); >+ } >+ } else { >+ result[ 0 ] = defaultProgressManager; >+ } >+ return result[ 0 ]; >+ } >+ } >+ >+ private void bindToSession( final Object keyToRemove ) { >+ ISessionStore session = RWT.getSessionStore(); >+ HttpSessionBindingListener watchDog = new HttpSessionBindingListener() { >+ public void valueBound( final HttpSessionBindingEvent event ) { >+ } >+ public void valueUnbound( final HttpSessionBindingEvent event ) { >+ try { >+ handleWatchDog( keyToRemove ); >+ } finally { >+ synchronized( lock ) { >+ jobs.remove( keyToRemove ); >+ } >+ } >+ } >+ >+ private void handleWatchDog( final Object keyToRemove ) { >+ // //////////////////////////////////////////////////////////////////// >+ // TODO [fappel]: Very ugly hack to avoid a memory leak. >+ // As a job can not be removed from the >+ // running set directly, I use reflection. Jobs >+ // can be catched in the set on session timeouts. >+ // Don't know a proper solution yet. >+ // Note that this is still under investigation. >+ if( keyToRemove instanceof Job ) { >+ final Job jobToRemove = ( Job )keyToRemove; >+ Display display = ( Display )jobs.get( jobToRemove ); >+ if( display != null ) { >+ UICallBack.runNonUIThreadWithFakeContext( display, new Runnable() { >+ public void run() { >+ jobToRemove.cancel(); >+ jobToRemove.addJobChangeListener( new JobCanceler() ); >+ } >+ } ); >+ } >+ try { >+ IJobManager jobManager = Job.getJobManager(); >+ Class clazz = jobManager.getClass(); >+ Field running = clazz.getDeclaredField( "running" ); >+ running.setAccessible( true ); >+ Set set = ( Set )running.get( jobManager ); >+ synchronized( lock ) { >+ set.remove( keyToRemove ); >+ // still sometimes job get catched - use the job marker adapter >+ // to check whether they can be eliminated >+ Object[] runningJobs = set.toArray(); >+ for( int i = 0; i < runningJobs.length; i++ ) { >+ Job toCheck = ( Job )runningJobs[ i ]; >+ IJobMarker marker >+ = ( IJobMarker )toCheck.getAdapter( IJobMarker.class ); >+ if( marker != null && marker.canBeRemoved() ) { >+ set.remove( toCheck ); >+ } >+ } >+ } >+ } catch( final Throwable thr ) { >+ // TODO [fappel]: exception handling >+ thr.printStackTrace(); >+ } >+ } >+ } >+ }; >+ session.setAttribute( String.valueOf( watchDog.hashCode() ), watchDog ); >+ } >+} >Index: Eclipse UI/org/eclipse/rap/ui/internal/preferences/SessionPreferencesNode.java >=================================================================== >RCS file: Eclipse UI/org/eclipse/rap/ui/internal/preferences/SessionPreferencesNode.java >diff -N Eclipse UI/org/eclipse/rap/ui/internal/preferences/SessionPreferencesNode.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI/org/eclipse/rap/ui/internal/preferences/SessionPreferencesNode.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,508 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 Innoopract Informationssysteme GmbH. >+ * 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: >+ * Innoopract Informationssysteme GmbH - initial API and implementation >+ ******************************************************************************/ >+package org.eclipse.rap.ui.internal.preferences; >+ >+import java.util.*; >+ >+import org.eclipse.core.runtime.preferences.IEclipsePreferences; >+import org.eclipse.core.runtime.preferences.IPreferenceNodeVisitor; >+import org.eclipse.osgi.util.NLS; >+import org.eclipse.rwt.RWT; >+import org.eclipse.rwt.internal.util.ParamCheck; >+import org.eclipse.rwt.service.ISettingStore; >+import org.eclipse.rwt.service.SettingStoreException; >+import org.eclipse.ui.internal.preferences.Base64; >+import org.osgi.service.prefs.BackingStoreException; >+import org.osgi.service.prefs.Preferences; >+ >+/** >+ * This node use the RWT setting store to persist its preferences. >+ */ >+final class SessionPreferencesNode implements IEclipsePreferences { >+ >+ private static final String PATH_SEPARATOR = "/"; //$NON-NLS-1$ >+ private static final String DOUBLE_PATH_SEPARATOR = "//"; //$NON-NLS-1$ >+ private static final String TRUE = "true"; //$NON-NLS-1$ >+ private static final String FALSE = "false"; //$NON-NLS-1$ >+ >+ private final String name; >+ private final IEclipsePreferences parent; >+ private boolean isRemoved; >+ /* cache the absolutePath once it has been computed */ >+ private String absolutePath; >+ >+ private final Map children = new HashMap(); // !thread safe >+ >+ SessionPreferencesNode( final IEclipsePreferences parent, >+ final String name ) >+ { >+ ParamCheck.notNull( parent, "parent" ); //$NON-NLS-1$ >+ ParamCheck.notNull( name, "name" ); //$NON-NLS-1$ >+ checkName( name ); >+ this.parent = parent; >+ this.name = name; >+ } >+ >+ public void accept( final IPreferenceNodeVisitor visitor ) >+ throws BackingStoreException >+ { >+ boolean withChildren = visitor.visit( this ); >+ if( withChildren ) { >+ Object[] childrenArray; >+ synchronized( this ) { >+ childrenArray = children.values().toArray(); >+ } >+ for( int i = 0; i < childrenArray.length; i++ ) { >+ IEclipsePreferences child = ( IEclipsePreferences )childrenArray[ i ]; >+ child.accept( visitor ); >+ } >+ } >+ } >+ >+ public void addNodeChangeListener( final INodeChangeListener listener ) { >+ checkRemoved(); >+ if( listener != null ) { >+ getNodeCore().addNodeChangeListener( listener ); >+ } >+ } >+ >+ public void addPreferenceChangeListener( >+ final IPreferenceChangeListener listener ) >+ { >+ checkRemoved(); >+ getNodeCore().addPreferenceChangeListener( listener ); >+ } >+ >+ public Preferences node( final String path ) { >+ checkPath( path ); >+ checkRemoved(); >+ Preferences result; >+ if( "".equals( path ) ) { // "" //$NON-NLS-1$ >+ result = this; >+ } else if( path.startsWith( PATH_SEPARATOR ) ) { // "/absolute/path" >+ result = findRoot().node( path.substring( 1 ) ); >+ } else if( path.indexOf( PATH_SEPARATOR ) > 0 ) { // "foo/bar/baz" >+ int index = path.indexOf( PATH_SEPARATOR ); >+ String nodeName = path.substring( 0, index ); >+ String rest = path.substring( index + 1, path.length() ); >+ result = getChild( nodeName, true ).node( rest ); >+ } else { // "foo" >+ result = getChild( path, true ); >+ } >+ return result; >+ } >+ >+ public synchronized void removeNode() throws BackingStoreException { >+ checkRemoved(); >+ // remove all preferences >+ clear(); >+ // remove all children >+ Object[] childNodes = children.values().toArray(); >+ for( int i = 0; i < childNodes.length; i++ ) { >+ Preferences child = ( Preferences )childNodes[ i ]; >+ if( child.nodeExists( "" ) ) { // if !removed //$NON-NLS-1$ >+ child.removeNode(); >+ } >+ } >+ // remove from parent; this is ugly, because the interface >+ // Preference has no API for removing oneself from the parent. >+ // In general the parent will be a SessionPreferencesNode. >+ // The only case in the workbench where this is not true, is one level >+ // below the root (i.e. at /session ), but the scope root must not >+ // be removable (see IEclipsePreferences#removeNode()) >+ if( parent instanceof SessionPreferencesNode ) { >+ // this means: >+ // (a) we know what kind of parent we have, and >+ // (b) we are not the scope root, since that has a >+ /// RootPreference as a parent >+ SessionPreferencesNode spnParent >+ = ( ( SessionPreferencesNode ) parent ); >+ spnParent.children.remove( name ); >+ spnParent.fireNodeEvent( this, false ); >+ >+ // the listeners are not needed anymore >+ getNodeCore().clear(); >+ children.clear(); >+ isRemoved = true; >+ } >+ } >+ >+ public void removeNodeChangeListener( final INodeChangeListener listener ) { >+ checkRemoved(); >+ if( listener != null ) { >+ getNodeCore().removeNodeChangeListener( listener ); >+ } >+ } >+ >+ public void removePreferenceChangeListener( >+ final IPreferenceChangeListener listener ) >+ { >+ checkRemoved(); >+ getNodeCore().removePreferenceChangeListener( listener ); >+ } >+ >+ public String absolutePath() { >+ if( absolutePath == null ) { >+ if( parent == null ) { >+ absolutePath = name; >+ } else { >+ String parentPath = parent.absolutePath(); >+ absolutePath = parentPath.endsWith( PATH_SEPARATOR ) >+ ? parentPath + name >+ : parentPath + PATH_SEPARATOR + name; >+ } >+ } >+ return absolutePath; >+ } >+ >+ public synchronized String[] childrenNames() { >+ checkRemoved(); >+ Set names = children.keySet(); >+ return ( String[] )names.toArray( new String[ names.size() ] ); >+ } >+ >+ public void clear() { >+ checkRemoved(); >+ String[] keys = internalGetKeys(); >+ for( int i = 0; i < keys.length; i++ ) { >+ remove( keys[ i ] ); >+ } >+ } >+ >+ public void flush() { >+ checkRemoved(); >+ // the current implementation persists everytime the preferences >+ // are modified, so there's nothing to do here >+ } >+ >+ public String get( final String key, final String def ) { >+ ParamCheck.notNull( key, "key" ); //$NON-NLS-1$ >+ checkRemoved(); >+ String result = internalGet( key ); >+ return result == null ? def : result; >+ } >+ >+ public boolean getBoolean( final String key, final boolean def ) { >+ ParamCheck.notNull( key, "key" ); //$NON-NLS-1$ >+ checkRemoved(); >+ String value = internalGet( key ); >+ return value == null ? def : Boolean.valueOf( value ).booleanValue(); >+ } >+ >+ public byte[] getByteArray( final String key, final byte[] def ) { >+ ParamCheck.notNull( key, "key" ); //$NON-NLS-1$ >+ checkRemoved(); >+ String value = internalGet( key ); >+ return value == null ? def : Base64.decode( value.getBytes() ); >+ } >+ >+ public double getDouble( final String key, final double def ) { >+ ParamCheck.notNull( key, "key" ); //$NON-NLS-1$ >+ checkRemoved(); >+ String value = internalGet( key ); >+ double result = def; >+ if( value != null ) { >+ try { >+ result = Double.parseDouble( value ); >+ } catch( NumberFormatException nfe ) { >+ // returns def >+ } >+ } >+ return result; >+ } >+ >+ public float getFloat( final String key, final float def ) { >+ ParamCheck.notNull( key, "key" ); //$NON-NLS-1$ >+ checkRemoved(); >+ String value = internalGet( key ); >+ float result = def; >+ if( value != null ) { >+ try { >+ result = Float.parseFloat( value ); >+ } catch( NumberFormatException nfe ) { >+ // returns def >+ } >+ } >+ return result; >+ } >+ >+ public int getInt( final String key, final int def ) { >+ ParamCheck.notNull( key, "key" ); //$NON-NLS-1$ >+ checkRemoved(); >+ String value = internalGet( key ); >+ int result = def; >+ if( value != null ) { >+ try { >+ result = Integer.parseInt( value ); >+ } catch( NumberFormatException nfe ) { >+ // returns def >+ } >+ } >+ return result; >+ } >+ >+ public long getLong( final String key, final long def ) { >+ ParamCheck.notNull( key, "key" ); //$NON-NLS-1$ >+ checkRemoved(); >+ String value = internalGet( key ); >+ long result = def; >+ if( value != null ) { >+ try { >+ result = Long.parseLong( value ); >+ } catch( NumberFormatException nfe ) { >+ // returns def >+ } >+ } >+ return result; >+ } >+ >+ public String[] keys() { >+ checkRemoved(); >+ return internalGetKeys(); >+ } >+ >+ public String name() { >+ return name; >+ } >+ >+ public synchronized boolean nodeExists( final String path ) >+ throws BackingStoreException >+ { >+ boolean result; >+ if( "".equals( path ) ) { //$NON-NLS-1$ >+ result = !isRemoved; >+ } else { >+ checkRemoved(); >+ checkPath( path ); >+ if( path.startsWith( PATH_SEPARATOR ) ) { // "/absolute/path" >+ result = findRoot().nodeExists( path.substring( 1 ) ); >+ } else if( path.indexOf( PATH_SEPARATOR ) > 0 ) { // "foo/bar/baz" >+ int index = path.indexOf( PATH_SEPARATOR ); >+ String nodeName = path.substring( 0, index ); >+ String rest = path.substring( index + 1, path.length() ); >+ SessionPreferencesNode child = getChild( nodeName, false ); >+ result = child == null ? false : child.nodeExists( rest ); >+ } else { // "foo" >+ result = children.containsKey( path ); >+ } >+ } >+ return result; >+ } >+ >+ public Preferences parent() { >+ checkRemoved(); >+ return parent; >+ } >+ >+ public void put( final String key, final String newValue ) { >+ ParamCheck.notNull( key, "key" ); //$NON-NLS-1$ >+ ParamCheck.notNull( newValue, "newValue" ); //$NON-NLS-1$ >+ checkRemoved(); >+ String oldValue = internalPut( key, newValue ); >+ if( !newValue.equals( oldValue ) ) { >+ getNodeCore().firePreferenceEvent( key, oldValue, newValue ); >+ } >+ } >+ >+ public void putBoolean( final String key, final boolean value ) { >+ ParamCheck.notNull( key, "key" ); //$NON-NLS-1$ >+ checkRemoved(); >+ String newValue = value ? TRUE : FALSE; >+ String oldValue = internalPut( key, newValue ); >+ if( !newValue.equals( oldValue ) ) { >+ getNodeCore().firePreferenceEvent( key, oldValue, newValue ); >+ } >+ } >+ >+ public void putByteArray( final String key, final byte[] value ) { >+ ParamCheck.notNull( key, "key" ); //$NON-NLS-1$ >+ ParamCheck.notNull( value, "newValue" ); //$NON-NLS-1$ >+ checkRemoved(); >+ String newValue = new String( Base64.encode( value ) ); >+ String oldValue = internalPut( key, newValue ); >+ if( !newValue.equals( oldValue) ) { >+ getNodeCore().firePreferenceEvent( key, oldValue, newValue ); >+ } >+ } >+ >+ public void putDouble( final String key, final double value ) { >+ ParamCheck.notNull( key, "key" ); //$NON-NLS-1$ >+ checkRemoved(); >+ String newValue = String.valueOf( value ); >+ String oldValue = internalPut( key, newValue ); >+ if( !newValue.equals( oldValue ) ) { >+ getNodeCore().firePreferenceEvent( key, oldValue, newValue ); >+ } >+ } >+ >+ public void putFloat( final String key, final float value ) { >+ ParamCheck.notNull( key, "key" ); //$NON-NLS-1$ >+ checkRemoved(); >+ String newValue = String.valueOf( value ); >+ String oldValue = internalPut( key, newValue ); >+ if( !newValue.equals( oldValue ) ) { >+ getNodeCore().firePreferenceEvent( key, oldValue, newValue ); >+ } >+ } >+ >+ public void putInt( final String key, final int value ) { >+ ParamCheck.notNull( key, "key" ); //$NON-NLS-1$ >+ checkRemoved(); >+ String newValue = String.valueOf( value ); >+ String oldValue = internalPut( key, newValue ); >+ if( !newValue.equals( oldValue ) ) { >+ getNodeCore().firePreferenceEvent( key, oldValue, newValue ); >+ } >+ } >+ >+ public void putLong( final String key, final long value ) { >+ ParamCheck.notNull( key, "key" ); //$NON-NLS-1$ >+ checkRemoved(); >+ String newValue = String.valueOf( value ); >+ String oldValue = internalPut( key, newValue ); >+ if( !newValue.equals( oldValue ) ) { >+ getNodeCore().firePreferenceEvent( key, oldValue, newValue ); >+ } >+ } >+ >+ public void remove( final String key ) { >+ checkRemoved(); >+ String oldValue = internalGet( key ); >+ if( oldValue != null ) { >+ internalPut( key, null ); >+ getNodeCore().firePreferenceEvent( key, oldValue, null ); >+ } >+ } >+ >+ public void sync() throws BackingStoreException { >+ checkRemoved(); >+ ISettingStore store = RWT.getSettingStore(); >+ String id = store.getId(); >+ try { >+ store.loadById( id ); >+ } catch( SettingStoreException sse ) { >+ throw new BackingStoreException( "Failed to sync() node", sse ); //$NON-NLS-1$ >+ } >+ } >+ >+ public String toString() { >+ return absolutePath() + "@" + hashCode(); //$NON-NLS-1$ >+ } >+ >+ ////////////////// >+ // helping methods >+ >+ private void checkName( final String nodeName ) { >+ if( nodeName.indexOf( PATH_SEPARATOR ) != -1 ) { >+ String unboundMsg = "Name ''{0}'' cannot contain or end with ''{1}''"; //$NON-NLS-1$ >+ String msg = NLS.bind( unboundMsg, nodeName, PATH_SEPARATOR ); >+ throw new IllegalArgumentException( msg ); >+ } >+ } >+ >+ private void checkPath( final String path ) { >+ if( path.indexOf( DOUBLE_PATH_SEPARATOR ) != -1 ) { >+ String unboundMsg = "''{0}'' is not allowed in path ''{1}''"; //$NON-NLS-1$ >+ String msg = NLS.bind( unboundMsg, DOUBLE_PATH_SEPARATOR, path ); >+ throw new IllegalArgumentException( msg ); >+ } >+ if( path.length() > 1 && path.endsWith( PATH_SEPARATOR ) ) { >+ String unboundMsg = "path ''{0}'' cannot end with ''{1}''"; //$NON-NLS-1$ >+ String msg = NLS.bind( unboundMsg, path, PATH_SEPARATOR ); >+ throw new IllegalArgumentException( msg ); >+ } >+ } >+ >+ private synchronized void checkRemoved() { >+ if( isRemoved ) { >+ String msg = "node ''{0}'' has been removed"; //$NON-NLS-1$ >+ throw new IllegalStateException( NLS.bind( msg, this.absolutePath() ) ); >+ } >+ } >+ >+ private synchronized SessionPreferencesNode createChild( >+ final String childName ) >+ { >+ SessionPreferencesNode result >+ = new SessionPreferencesNode( this, childName ); >+ children.put( childName, result ); >+ fireNodeEvent( result, true ); >+ return result; >+ } >+ >+ private synchronized SessionPreferencesNode getChild( >+ final String childName, >+ final boolean doCreate ) >+ { >+ SessionPreferencesNode result >+ = ( SessionPreferencesNode )children.get( childName ); >+ if( result == null && doCreate ) { >+ result = createChild( childName ); >+ } >+ return result; >+ } >+ >+ private String[] internalGetKeys() { >+ List result = new ArrayList(); >+ >+ String prefix = absolutePath() + PATH_SEPARATOR; >+ int prefixLength = prefix.length(); >+ >+ Enumeration attrNames = RWT.getSettingStore().getAttributeNames(); >+ while( attrNames.hasMoreElements() ) { >+ String attr = ( String )attrNames.nextElement(); >+ if( attr.startsWith( prefix ) ) { >+ String key = attr.substring( prefixLength ); >+ result.add( key ); >+ } >+ } >+ return ( String[] )result.toArray( new String[ result.size() ] ); >+ } >+ >+ private Preferences findRoot() { >+ Preferences result = this; >+ while( result.parent() != null ) { >+ result = result.parent(); >+ } >+ return result; >+ } >+ >+ private String internalGet( final String key ) { >+ ISettingStore store = RWT.getSettingStore(); >+ String uniqueKey = absolutePath() + PATH_SEPARATOR + key; >+ return store.getAttribute( uniqueKey ); >+ } >+ >+ private synchronized String internalPut( final String key, >+ final String value ) { >+ String uniqueKey = absolutePath() + PATH_SEPARATOR + key; >+ return getNodeCore().put( uniqueKey, value ); >+ } >+ >+ private void fireNodeEvent( final Preferences child, >+ final boolean wasAdded ) { >+ getNodeCore().fireNodeEvent( child, wasAdded, this ); >+ } >+ >+ private SessionPreferenceNodeCore getNodeCore() { >+ SessionPreferenceNodeCore result; >+ final String key = absolutePath(); >+ Object object = RWT.getSessionStore().getAttribute( key ); >+ if( object instanceof SessionPreferenceNodeCore ) { >+ result = ( SessionPreferenceNodeCore )object; >+ } else { >+ result = new SessionPreferenceNodeCore( this ); >+ RWT.getSessionStore().setAttribute( key, result ); >+ } >+ return result; >+ } >+ >+} >#P org.eclipse.rap.design.example >Index: src/org/eclipse/rap/internal/design/example/builder/PerspectiveSwitcherBuilder.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.ui/org.eclipse.rap.design.example/src/org/eclipse/rap/internal/design/example/builder/PerspectiveSwitcherBuilder.java,v >retrieving revision 1.1 >diff -u -r1.1 PerspectiveSwitcherBuilder.java >--- src/org/eclipse/rap/internal/design/example/builder/PerspectiveSwitcherBuilder.java 31 Aug 2009 13:14:12 -0000 1.1 >+++ src/org/eclipse/rap/internal/design/example/builder/PerspectiveSwitcherBuilder.java 11 Sep 2009 08:35:42 -0000 >@@ -17,6 +17,7 @@ > import org.eclipse.core.runtime.preferences.IEclipsePreferences; > import org.eclipse.rap.internal.design.example.business.layoutsets.PerspectiveSwitcherInitializer; > import org.eclipse.rap.ui.interactiondesign.layout.ElementBuilder; >+import org.eclipse.rap.ui.internal.preferences.SessionScope; > import org.eclipse.rwt.graphics.Graphics; > import org.eclipse.rwt.lifecycle.WidgetUtil; > import org.eclipse.swt.SWT; >@@ -44,7 +45,6 @@ > import org.eclipse.ui.WorkbenchException; > import org.eclipse.ui.actions.ActionFactory; > import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction; >-import org.eclipse.ui.internal.preferences.SessionScope; > import org.osgi.service.prefs.BackingStoreException; > import org.osgi.service.prefs.Preferences; >
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 279613
: 146933