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 154288 Details for
Bug 226618
[context] move task-specific editor memento storage out of the plug-in preference store
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]
next iteration
clipboard.txt (text/plain), 63.61 KB, created by
Steffen Pingel
on 2009-12-11 01:25:04 EST
(
hide
)
Description:
next iteration
Filename:
MIME Type:
Creator:
Steffen Pingel
Created:
2009-12-11 01:25:04 EST
Size:
63.61 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mylyn.context.core >Index: src/org/eclipse/mylyn/internal/context/core/ContextUtil.java >=================================================================== >RCS file: src/org/eclipse/mylyn/internal/context/core/ContextUtil.java >diff -N src/org/eclipse/mylyn/internal/context/core/ContextUtil.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/internal/context/core/ContextUtil.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,27 @@ >+/******************************************************************************* >+ * Copyright (c) 2009 Tasktop Technologies and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Tasktop Technologies - initial API and implementation >+ *******************************************************************************/ >+ >+package org.eclipse.mylyn.internal.context.core; >+ >+import java.io.UnsupportedEncodingException; >+import java.net.URLEncoder; >+ >+public class ContextUtil { >+ >+ public static String encodeHandle(String handleIdentifier) { >+ try { >+ return URLEncoder.encode(handleIdentifier, InteractionContextManager.CONTEXT_FILENAME_ENCODING); >+ } catch (UnsupportedEncodingException e) { >+ throw new IllegalArgumentException("Invalid handle: " + handleIdentifier); //$NON-NLS-1$ >+ } >+ } >+ >+} >#P org.eclipse.mylyn.context.ui >Index: src/org/eclipse/mylyn/internal/context/ui/ContextEditorManager.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.context.ui/src/org/eclipse/mylyn/internal/context/ui/ContextEditorManager.java,v >retrieving revision 1.21 >diff -u -r1.21 ContextEditorManager.java >--- src/org/eclipse/mylyn/internal/context/ui/ContextEditorManager.java 7 Oct 2009 23:15:05 -0000 1.21 >+++ src/org/eclipse/mylyn/internal/context/ui/ContextEditorManager.java 11 Dec 2009 06:27:43 -0000 >@@ -11,29 +11,23 @@ > > package org.eclipse.mylyn.internal.context.ui; > >-import java.io.IOException; >-import java.io.StringReader; >-import java.io.StringWriter; > import java.util.ArrayList; > import java.util.Arrays; > import java.util.HashSet; > import java.util.List; > import java.util.Set; > >-import org.eclipse.core.runtime.Assert; > import org.eclipse.core.runtime.ISafeRunnable; > import org.eclipse.core.runtime.IStatus; > import org.eclipse.core.runtime.MultiStatus; > import org.eclipse.core.runtime.Status; >-import org.eclipse.core.runtime.preferences.InstanceScope; >-import org.eclipse.jface.preference.IPreferenceStore; > import org.eclipse.jface.util.SafeRunnable; > import org.eclipse.mylyn.commons.core.StatusHandler; > import org.eclipse.mylyn.context.core.AbstractContextListener; > import org.eclipse.mylyn.context.core.AbstractContextStructureBridge; > import org.eclipse.mylyn.context.core.ContextChangeEvent; > import org.eclipse.mylyn.context.core.ContextCore; >-import org.eclipse.mylyn.context.core.IInteractionContext; >+import org.eclipse.mylyn.context.core.IInteractionContextManager; > import org.eclipse.mylyn.context.core.IInteractionElement; > import org.eclipse.mylyn.context.ui.AbstractContextUiBridge; > import org.eclipse.mylyn.context.ui.ContextUi; >@@ -51,24 +45,58 @@ > import org.eclipse.ui.IWorkbenchWindow; > import org.eclipse.ui.PartInitException; > import org.eclipse.ui.PlatformUI; >-import org.eclipse.ui.XMLMemento; > import org.eclipse.ui.internal.EditorManager; > import org.eclipse.ui.internal.IPreferenceConstants; > import org.eclipse.ui.internal.IWorkbenchConstants; > import org.eclipse.ui.internal.Workbench; > import org.eclipse.ui.internal.WorkbenchPage; > import org.eclipse.ui.internal.WorkbenchWindow; >-import org.eclipse.ui.preferences.ScopedPreferenceStore; > > /** > * @author Mik Kersten > * @author Shawn Minto > */ >-public class ContextEditorManager extends AbstractContextListener { >+public class ContextEditorManager { > >- private static final String PREFS_PREFIX = "editors.task."; //$NON-NLS-1$ >+ static final String MEMENTO_EDITORS = "org.eclipse.mylyn.context.ui.editors"; //$NON-NLS-1$ > >- private static final String KEY_CONTEXT_EDITORS = "ContextOpenEditors"; //$NON-NLS-1$ >+ private class MementoListener extends ContextMementoListener { >+ >+ @Override >+ public void clearState(String contextHandle, boolean isActiveContext) { >+ ContextEditorManager.this.clearState(contextHandle, isActiveContext); >+ } >+ >+ @Override >+ public void restoreState(ContextMemento memento) { >+ ContextEditorManager.this.restoreState(memento); >+ } >+ >+ @Override >+ public void saveState(ContextMemento memento) { >+ ContextEditorManager.this.saveState(memento); >+ } >+ >+ } >+ >+ private class ContextListener extends AbstractContextListener { >+ >+ @Override >+ public void contextChanged(ContextChangeEvent event) { >+ switch (event.getEventKind()) { >+ case INTEREST_CHANGED: >+ for (IInteractionElement element : event.getElements()) { >+ closeEditor(element, false); >+ } >+ break; >+ case ELEMENTS_DELETED: >+ for (IInteractionElement element : event.getElements()) { >+ closeEditor(element, true); >+ } >+ break; >+ } >+ } >+ } > > private static final String KEY_MONITORED_WINDOW_OPEN_EDITORS = "MonitoredWindowOpenEditors"; //$NON-NLS-1$ > >@@ -83,41 +111,29 @@ > private boolean previousCloseEditorsSetting = Workbench.getInstance().getPreferenceStore().getBoolean( > IPreferenceConstants.REUSE_EDITORS_BOOLEAN); > >- private final IPreferenceStore preferenceStore; >+ private final MementoListener mementoListener; >+ >+ private final ContextListener contextListener; >+ >+ //private final IPreferenceStore preferenceStore; > > public ContextEditorManager() { >- preferenceStore = new ScopedPreferenceStore(new InstanceScope(), "org.eclipse.mylyn.resources.ui"); //$NON-NLS-1$ >+ //preferenceStore = new ScopedPreferenceStore(new InstanceScope(), "org.eclipse.mylyn.resources.ui"); //$NON-NLS-1$ >+ this.mementoListener = new MementoListener(); >+ this.contextListener = new ContextListener(); > } > >- @Override >- public void contextChanged(ContextChangeEvent event) { >- switch (event.getEventKind()) { >- case ACTIVATED: >- openEditorsFromMemento(event.getContext()); >- break; >- case DEACTIVATED: >- closeEditorsAndSaveMemento(event.getContext()); >- break; >- case INTEREST_CHANGED: >- for (IInteractionElement element : event.getElements()) { >- closeEditor(element, false); >- } >- break; >- case ELEMENTS_DELETED: >- for (IInteractionElement element : event.getElements()) { >- closeEditor(element, true); >- } >- break; >- case CLEARED: >- // use the handle since the context is null when it is cleared >- // bug 255588 >- clearEditorMemento(event.getContextHandle(), event.isActiveContext()); >- break; >+ public void start(IInteractionContextManager contextManager, ContextMementoManager mementoManager) { >+ contextManager.addListener(contextListener); >+ mementoManager.addMementoListener(mementoListener); >+ } > >- } >+ public void stop(IInteractionContextManager contextManager, ContextMementoManager mementoManager) { >+ contextManager.removeListener(contextListener); >+ mementoManager.removeMementoListener(mementoListener); > } > >- public void openEditorsFromMemento(IInteractionContext context) { >+ public void restoreState(ContextMemento state) { > if (!Workbench.getInstance().isStarting() > && ContextUiPlugin.getDefault().getPreferenceStore().getBoolean( > IContextUiPreferenceContstants.AUTO_MANAGE_EDITORS) && !TaskMigrator.isActive()) { >@@ -131,12 +147,13 @@ > ContextCore.getContextManager().setContextCapturePaused(true); > } > String mementoString = null; >- // TODO change where memento is stored > IWorkbenchWindow activeWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); > try { >- mementoString = readEditorMemento(context.getHandleIdentifier()); >- if (mementoString != null && !mementoString.trim().equals("")) { //$NON-NLS-1$ >- IMemento memento = XMLMemento.createReadRoot(new StringReader(mementoString)); >+// mementoString = readEditorMemento(context.getHandleIdentifier()); >+// if (mementoString != null && !mementoString.trim().equals("")) { //$NON-NLS-1$ >+// IMemento memento = XMLMemento.createReadRoot(new StringReader(mementoString)); >+ IMemento memento = state.getMemento(MEMENTO_EDITORS); >+ if (memento != null) { > IMemento[] children = memento.getChildren(KEY_MONITORED_WINDOW_OPEN_EDITORS); > if (children.length > 0) { > // This code supports restore from multiple windows >@@ -159,7 +176,7 @@ > "Could not restore all editors, memento: \"" + mementoString + "\"", e)); //$NON-NLS-1$ //$NON-NLS-2$ > } > activeWindow.setActivePage(activeWindow.getActivePage()); >- IInteractionElement activeNode = context.getActiveNode(); >+ IInteractionElement activeNode = state.getContext().getActiveNode(); > if (activeNode != null) { > ContextUi.getUiBridge(activeNode.getContentType()).open(activeNode); > } >@@ -173,7 +190,6 @@ > } > > private WorkbenchPage getWorkbenchPageForMemento(IMemento memento, IWorkbenchWindow activeWindow) { >- > String windowToRestoreClassName = memento.getString(ATTRIBUTE_CLASS); > if (windowToRestoreClassName == null) { > windowToRestoreClassName = ""; //$NON-NLS-1$ >@@ -226,22 +242,23 @@ > return null; > } > >- private String readEditorMemento(String handleIdentifier) { >- return preferenceStore.getString(PREFS_PREFIX + handleIdentifier); >- } >+// private String readEditorMemento(String handleIdentifier) { >+// return preferenceStore.getString(PREFS_PREFIX + handleIdentifier); >+// } > >- public void closeEditorsAndSaveMemento(IInteractionContext context) { >+ public void saveState(ContextMemento state) { > if (!PlatformUI.getWorkbench().isClosing() > && ContextUiPlugin.getDefault().getPreferenceStore().getBoolean( > IContextUiPreferenceContstants.AUTO_MANAGE_EDITORS) && !TaskMigrator.isActive()) { >- closeAllButActiveTaskEditor(context.getHandleIdentifier()); >+ closeAllButActiveTaskEditor(state.getContextHandle()); > >- XMLMemento rootMemento = XMLMemento.createWriteRoot(KEY_CONTEXT_EDITORS); >+// XMLMemento rootMemento = XMLMemento.createWriteRoot(KEY_CONTEXT_EDITORS); > > IWorkbenchWindow activeWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); > IWorkbenchWindow launchingWindow = MonitorUi.getLaunchingWorkbenchWindow(); > Set<IWorkbenchWindow> monitoredWindows = MonitorUi.getMonitoredWindows(); > >+ IMemento rootMemento = state.createMemento(MEMENTO_EDITORS); > for (IWorkbenchWindow window : monitoredWindows) { > IMemento memento = rootMemento.createChild(KEY_MONITORED_WINDOW_OPEN_EDITORS); > >@@ -255,15 +272,15 @@ > memento.putBoolean(ATTRIBUTE_IS_ACTIVE, window == activeWindow); > ((WorkbenchPage) window.getActivePage()).getEditorManager().saveState(memento); > } >- // TODO: avoid storing with preferences due to bloat? >- StringWriter writer = new StringWriter(); >- try { >- rootMemento.save(writer); >- writeEditorMemento(context.getHandleIdentifier(), writer.getBuffer().toString()); >- } catch (IOException e) { >- StatusHandler.log(new Status(IStatus.ERROR, ContextUiPlugin.ID_PLUGIN, "Could not store editor state", //$NON-NLS-1$ >- e)); >- } >+// // TODO: avoid storing with preferences due to bloat? >+// StringWriter writer = new StringWriter(); >+// try { >+// rootMemento.save(writer); >+// writeEditorMemento(context, writer.getBuffer().toString()); >+// } catch (IOException e) { >+// StatusHandler.log(new Status(IStatus.ERROR, ContextUiPlugin.ID_PLUGIN, "Could not store editor state", //$NON-NLS-1$ >+// e)); >+// } > > Workbench.getInstance().getPreferenceStore().setValue(IPreferenceConstants.REUSE_EDITORS_BOOLEAN, > previousCloseEditorsSetting); >@@ -271,27 +288,16 @@ > } > } > >- public void writeEditorMemento(String contextHandle, String memento) { >- preferenceStore.setValue(PREFS_PREFIX + contextHandle, memento); >- } >+// public void writeEditorMemento(IInteractionContext context, String memento) { >+// preferenceStore.setValue(PREFS_PREFIX + context.getHandleIdentifier(), memento); >+// } > >- public void clearEditorMemento(String contextHandle, boolean closeEditors) { >+ public void clearState(String contextHandle, boolean closeEditors) { > > if (closeEditors) { > closeAllButActiveTaskEditor(contextHandle); > } > >- XMLMemento memento = XMLMemento.createWriteRoot(KEY_CONTEXT_EDITORS); >- >- // TODO: avoid storing with preferences due to bloat? >- StringWriter writer = new StringWriter(); >- try { >- memento.save(writer); >- writeEditorMemento(contextHandle, writer.getBuffer().toString()); >- } catch (IOException e) { >- StatusHandler.log(new Status(IStatus.ERROR, ContextUiPlugin.ID_PLUGIN, "Could not store editor state", e)); //$NON-NLS-1$ >- } >- > Workbench.getInstance().getPreferenceStore().setValue(IPreferenceConstants.REUSE_EDITORS_BOOLEAN, > previousCloseEditorsSetting); > if (closeEditors) { >@@ -302,10 +308,9 @@ > /** > * HACK: will fail to restore different parts with same name > */ >- @SuppressWarnings("unchecked") > private void restoreEditors(WorkbenchPage page, IMemento memento, boolean isActiveWindow) { > EditorManager editorManager = page.getEditorManager(); >- final ArrayList visibleEditors = new ArrayList(5); >+ final ArrayList<?> visibleEditors = new ArrayList<Object>(5); > final IEditorReference activeEditor[] = new IEditorReference[1]; > final MultiStatus result = new MultiStatus(PlatformUI.PLUGIN_ID, IStatus.OK, "", null); //$NON-NLS-1$ > >@@ -441,13 +446,4 @@ > } > } > >- public void copyEditorMemento(String sourceHandle, String targetHandle) { >- Assert.isNotNull(sourceHandle); >- Assert.isNotNull(targetHandle); >- String memento = readEditorMemento(sourceHandle); >- if (memento != null) { >- writeEditorMemento(targetHandle, memento); >- } >- } >- > } >Index: src/org/eclipse/mylyn/internal/context/ui/ContextMemento.java >=================================================================== >RCS file: src/org/eclipse/mylyn/internal/context/ui/ContextMemento.java >diff -N src/org/eclipse/mylyn/internal/context/ui/ContextMemento.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/internal/context/ui/ContextMemento.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,93 @@ >+/******************************************************************************* >+ * Copyright (c) 2004, 2008 Tasktop Technologies and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Tasktop Technologies - initial API and implementation >+ *******************************************************************************/ >+ >+package org.eclipse.mylyn.internal.context.ui; >+ >+import org.eclipse.core.runtime.Assert; >+import org.eclipse.mylyn.context.core.IInteractionContext; >+import org.eclipse.ui.IMemento; >+import org.eclipse.ui.XMLMemento; >+ >+/** >+ * Stores workspace specific settings for a context. >+ * >+ * @author Steffen Pingel >+ */ >+public class ContextMemento { >+ >+ private boolean dirty; >+ >+ private final IInteractionContext context; >+ >+ private String contextHandle; >+ >+ private final XMLMemento memento; >+ >+ public ContextMemento(IInteractionContext context, String contextHandle, XMLMemento memento) { >+ Assert.isNotNull(memento); >+ Assert.isNotNull(contextHandle); >+ this.context = context; >+ this.contextHandle = contextHandle; >+ this.memento = memento; >+ } >+ >+ void setContextHandle(String contextHandle) { >+ this.contextHandle = contextHandle; >+ } >+ >+ // XXX equals and hashcode should probably use the handle to determine equality >+ @Override >+ public boolean equals(Object obj) { >+ if (!(obj instanceof ContextMemento)) { >+ return false; >+ } >+ return context.equals(((ContextMemento) obj).context); >+ } >+ >+ @Override >+ public int hashCode() { >+ return context.hashCode(); >+ } >+ >+ public String getContextHandle() { >+ return contextHandle; >+ } >+ >+ public IInteractionContext getContext() { >+ return context; >+ } >+ >+ XMLMemento getMemento() { >+ return memento; >+ } >+ >+ public IMemento getMemento(String type) { >+ return memento.getChild(type); >+ } >+ >+ public IMemento createMemento(String type) { >+ dirty = true; >+ return memento.createChild(type); >+ } >+ >+ public boolean isDirty() { >+ return dirty; >+ } >+ >+ public void removeMemento(String type) { >+ memento.createChild(type); >+ } >+ >+ public void setDirty(boolean dirty) { >+ this.dirty = dirty; >+ } >+ >+} >Index: src/org/eclipse/mylyn/internal/context/ui/ContextMementoListener.java >=================================================================== >RCS file: src/org/eclipse/mylyn/internal/context/ui/ContextMementoListener.java >diff -N src/org/eclipse/mylyn/internal/context/ui/ContextMementoListener.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/internal/context/ui/ContextMementoListener.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,25 @@ >+/******************************************************************************* >+ * Copyright (c) 2004, 2008 Tasktop Technologies and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Tasktop Technologies - initial API and implementation >+ *******************************************************************************/ >+ >+package org.eclipse.mylyn.internal.context.ui; >+ >+/** >+ * @author Steffen Pingel >+ */ >+public abstract class ContextMementoListener { >+ >+ public abstract void clearState(String contextHandle, boolean isActiveContext); >+ >+ public abstract void restoreState(ContextMemento memento); >+ >+ public abstract void saveState(ContextMemento memento); >+ >+} >Index: src/org/eclipse/mylyn/internal/context/ui/ContextMementoManager.java >=================================================================== >RCS file: src/org/eclipse/mylyn/internal/context/ui/ContextMementoManager.java >diff -N src/org/eclipse/mylyn/internal/context/ui/ContextMementoManager.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/internal/context/ui/ContextMementoManager.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,318 @@ >+/******************************************************************************* >+ * Copyright (c) 2004, 2008 Tasktop Technologies and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Tasktop Technologies - initial API and implementation >+ *******************************************************************************/ >+ >+package org.eclipse.mylyn.internal.context.ui; >+ >+import java.io.BufferedReader; >+import java.io.BufferedWriter; >+import java.io.File; >+import java.io.FileInputStream; >+import java.io.FileOutputStream; >+import java.io.IOException; >+import java.io.InputStreamReader; >+import java.io.OutputStreamWriter; >+import java.util.HashMap; >+import java.util.List; >+import java.util.Map; >+import java.util.concurrent.CopyOnWriteArrayList; >+ >+import org.eclipse.core.runtime.Assert; >+import org.eclipse.core.runtime.IProgressMonitor; >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.MultiStatus; >+import org.eclipse.core.runtime.SafeRunner; >+import org.eclipse.core.runtime.Status; >+import org.eclipse.core.runtime.jobs.Job; >+import org.eclipse.jface.util.SafeRunnable; >+import org.eclipse.mylyn.commons.core.StatusHandler; >+import org.eclipse.mylyn.context.core.AbstractContextListener; >+import org.eclipse.mylyn.context.core.ContextChangeEvent; >+import org.eclipse.mylyn.context.core.IInteractionContext; >+import org.eclipse.mylyn.context.core.IInteractionContextManager; >+import org.eclipse.mylyn.internal.context.core.ContextUtil; >+import org.eclipse.osgi.util.NLS; >+import org.eclipse.ui.WorkbenchException; >+import org.eclipse.ui.XMLMemento; >+ >+/** >+ * @author Steffen Pingel >+ */ >+public class ContextMementoManager { >+ >+ private class ContextListener extends AbstractContextListener { >+ @Override >+ public void contextChanged(ContextChangeEvent event) { >+ switch (event.getEventKind()) { >+ case ACTIVATED: >+ restoreState(event.getContext()); >+ break; >+ case DEACTIVATED: >+ saveState(event.getContext()); >+ break; >+ case CLEARED: >+ // use the handle since the context is null when it is cleared >+ // bug 255588 >+ clearState(event.getContextHandle(), event.isActiveContext()); >+ break; >+ } >+ } >+ } >+ >+ /** >+ * Delays writing of mementos to avoid blocking UI thread. >+ */ >+ private class FlushJob extends Job { >+ >+ public FlushJob() { >+ super("Flush context mementos"); //$NON-NLS-1$ >+ setSystem(true); >+ setPriority(Job.SHORT); >+ } >+ >+ @Override >+ protected IStatus run(IProgressMonitor monitor) { >+ ContextMementoManager.this.flushPending(); >+ return Status.OK_STATUS; >+ } >+ >+ } >+ >+ private static final String TAG_CONTEXT_STATE = "ContextState"; //$NON-NLS-1$ >+ >+ private static final long FLUSH_DELAY = 500; >+ >+ private static final String CHARSET = "UTF-8"; //$NON-NLS-1$ >+ >+ private static final String EXTENSION = ".xml"; //$NON-NLS-1$ >+ >+ private final Map<String, ContextMemento> pending; >+ >+ private final File location; >+ >+ private FlushJob flushJob; >+ >+ private boolean scheduled; >+ >+ private final IInteractionContextManager contextManager; >+ >+ private final ContextListener contextListener; >+ >+ private final List<ContextMementoListener> listeners; >+ >+ public ContextMementoManager(IInteractionContextManager contextManager, File location) { >+ Assert.isNotNull(contextManager); >+ Assert.isNotNull(location); >+ this.contextManager = contextManager; >+ this.location = location; >+ this.contextListener = new ContextListener(); >+ this.pending = new HashMap<String, ContextMemento>(); >+ this.listeners = new CopyOnWriteArrayList<ContextMementoListener>(); >+ } >+ >+ public void addMementoListener(ContextMementoListener listener) { >+ if (listeners.contains(listener)) { >+ throw new IllegalStateException("listener already added"); //$NON-NLS-1$ >+ } >+ listeners.add(listener); >+ } >+ >+ public void removeMementoListener(ContextMementoListener listener) { >+ listeners.remove(listener); >+ } >+ >+ public void clearState(final String contextHandle, final boolean isActiveContext) { >+ final ContextMemento memento = createMemento(null, contextHandle); >+ for (final ContextMementoListener listener : listeners) { >+ SafeRunner.run(new SafeRunnable() { >+ public void run() throws Exception { >+ listener.clearState(contextHandle, isActiveContext); >+ } >+ >+ @Override >+ public void handleException(Throwable e) { >+ StatusHandler.log(new Status(IStatus.ERROR, ContextUiPlugin.ID_PLUGIN, >+ "Unexpected error processing context event", e)); //$NON-NLS-1$ >+ removeMementoListener(listener); >+ } >+ }); >+ } >+ delete(memento); >+ } >+ >+ public void saveState(IInteractionContext context) { >+ final ContextMemento memento = createMemento(context, context.getHandleIdentifier()); >+ for (final ContextMementoListener listener : listeners) { >+ SafeRunner.run(new SafeRunnable() { >+ public void run() throws Exception { >+ listener.saveState(memento); >+ } >+ >+ @Override >+ public void handleException(Throwable e) { >+ StatusHandler.log(new Status(IStatus.ERROR, ContextUiPlugin.ID_PLUGIN, >+ "Unexpected error processing context event", e)); //$NON-NLS-1$ >+ removeMementoListener(listener); >+ } >+ }); >+ } >+ if (memento.isDirty()) { >+ writeLater(memento); >+ } >+ } >+ >+ ContextMemento createMemento(IInteractionContext context, String contextHandle) { >+ return new ContextMemento(context, contextHandle, XMLMemento.createWriteRoot(TAG_CONTEXT_STATE)); >+ } >+ >+ public void restoreState(IInteractionContext context) { >+ final ContextMemento memento = read(context); >+ for (final ContextMementoListener listener : listeners) { >+ SafeRunner.run(new SafeRunnable() { >+ public void run() throws Exception { >+ listener.restoreState(memento); >+ } >+ >+ @Override >+ public void handleException(Throwable e) { >+ StatusHandler.log(new Status(IStatus.ERROR, ContextUiPlugin.ID_PLUGIN, >+ "Unexpected error processing context event", e)); //$NON-NLS-1$ >+ removeMementoListener(listener); >+ } >+ }); >+ } >+ } >+ >+ public synchronized void start() { >+ contextManager.addListener(contextListener); >+ } >+ >+ public synchronized void stop() { >+ contextManager.removeListener(contextListener); >+ synchronized (this) { >+ if (flushJob != null) { >+ flushJob.cancel(); >+ flushJob = null; >+ } >+ } >+ flushPending(); >+ } >+ >+ public synchronized void flushPending() { >+ MultiStatus status = new MultiStatus(ContextUiPlugin.ID_PLUGIN, 0, >+ "Failed to save context workbench state", null); //$NON-NLS-1$ >+ for (ContextMemento memento : pending.values()) { >+ if (memento.isDirty()) { >+ IStatus result = write(memento); >+ status.add(result); >+ } >+ } >+ pending.clear(); >+ if (!status.isOK()) { >+ StatusHandler.log(status); >+ } >+ } >+ >+ /** >+ * Public for testing. >+ */ >+ public ContextMemento read(IInteractionContext context) { >+ ContextMemento memento = read(context.getHandleIdentifier(), context); >+ if (memento == null) { >+ memento = createMemento(context, context.getHandleIdentifier()); >+ } >+ return memento; >+ } >+ >+ private ContextMemento read(String contextHandle, IInteractionContext context) { >+ synchronized (this) { >+ ContextMemento memento = pending.get(contextHandle); >+ if (memento != null) { >+ return memento; >+ } >+ } >+ >+ File file = getFile(contextHandle); >+ if (file.exists()) { >+ try { >+ BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), CHARSET)); >+ XMLMemento memento = XMLMemento.createReadRoot(reader); >+ return new ContextMemento(context, contextHandle, memento); >+ } catch (IOException e) { >+ StatusHandler.log(new Status(IStatus.ERROR, ContextUiPlugin.ID_PLUGIN, NLS.bind( >+ "Failed to read context memento from \"{0}\"", file.getAbsolutePath()), e)); //$NON-NLS-1$ >+ } catch (WorkbenchException e) { >+ StatusHandler.log(new Status(IStatus.ERROR, ContextUiPlugin.ID_PLUGIN, NLS.bind( >+ "Failed to read context memento from \"{0}\"", file.getAbsolutePath()), e)); //$NON-NLS-1$ >+ } >+ } >+ return null; >+ } >+ >+ IStatus write(ContextMemento memento) { >+ File file = getFile(memento.getContextHandle()); >+ if (!file.getParentFile().exists()) { >+ file.getParentFile().mkdirs(); >+ } >+ try { >+ BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), CHARSET)); >+ try { >+ memento.getMemento().save(writer); >+ } finally { >+ writer.close(); >+ } >+ } catch (IOException e) { >+ return new Status(IStatus.ERROR, ContextUiPlugin.ID_PLUGIN, NLS.bind( >+ "Failed to write context memento to \"{0}\"", file.getAbsolutePath()), e); //$NON-NLS-1$ >+ } >+ return Status.OK_STATUS; >+ } >+ >+ private File getFile(String contextHandle) { >+ return new File(location, ContextUtil.encodeHandle(contextHandle) + EXTENSION); >+ } >+ >+ public synchronized void delete(ContextMemento memento) { >+ String contextHandle = memento.getContextHandle(); >+ pending.remove(contextHandle); >+ File file = getFile(contextHandle); >+ if (file != null && file.exists()) { >+ boolean succeeded = file.delete(); >+ if (!succeeded) { >+ StatusHandler.log(new Status(IStatus.ERROR, ContextUiPlugin.ID_PLUGIN, NLS.bind( >+ "Unable to remove the editor memento \"{0}\"", file.getAbsolutePath()))); //$NON-NLS-1$ >+ } >+ } >+ } >+ >+ public synchronized void writeLater(ContextMemento memento) { >+ pending.put(memento.getContextHandle(), memento); >+ schedule(); >+ } >+ >+ private synchronized void schedule() { >+ if (!scheduled) { >+ if (flushJob == null) { >+ flushJob = new FlushJob(); >+ } >+ flushJob.schedule(FLUSH_DELAY); >+ } >+ } >+ >+ public void copy(String sourceHandle, String targetHandle) { >+ Assert.isNotNull(sourceHandle); >+ Assert.isNotNull(targetHandle); >+ ContextMemento memento = read(sourceHandle, null); >+ if (memento != null) { >+ memento.setContextHandle(targetHandle); >+ write(memento); >+ } >+ } >+} >Index: src/org/eclipse/mylyn/internal/context/ui/ContextPerspectiveManager.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.context.ui/src/org/eclipse/mylyn/internal/context/ui/ContextPerspectiveManager.java,v >retrieving revision 1.27 >diff -u -r1.27 ContextPerspectiveManager.java >--- src/org/eclipse/mylyn/internal/context/ui/ContextPerspectiveManager.java 8 Dec 2009 01:43:26 -0000 1.27 >+++ src/org/eclipse/mylyn/internal/context/ui/ContextPerspectiveManager.java 11 Dec 2009 06:27:44 -0000 >@@ -15,8 +15,7 @@ > import java.util.Set; > > import org.eclipse.jface.preference.IPreferenceStore; >-import org.eclipse.mylyn.tasks.core.ITask; >-import org.eclipse.mylyn.tasks.core.ITaskActivationListener; >+import org.eclipse.ui.IMemento; > import org.eclipse.ui.IPerspectiveDescriptor; > import org.eclipse.ui.IPerspectiveListener4; > import org.eclipse.ui.IWorkbenchPage; >@@ -28,10 +27,36 @@ > import org.eclipse.ui.internal.registry.IActionSetDescriptor; > > /** >+ * Saves the active perspective on context deactivation and restores it on activation. >+ * > * @author Mik Kersten > * @author Shawn Minto >+ * @author Steffen Pingel > */ >-public class ContextPerspectiveManager implements ITaskActivationListener, IPerspectiveListener4 { >+public class ContextPerspectiveManager implements IPerspectiveListener4 { >+ >+ static final String KEY_ACTIVE_ID = "activeId"; //$NON-NLS-1$ >+ >+ static final String MEMENTO_PERSPECTIVE = "org.eclipse.mylyn.context.ui.perspectives"; //$NON-NLS-1$ >+ >+ private class MementoListener extends ContextMementoListener { >+ >+ @Override >+ public void clearState(String contextHandle, boolean isActiveContext) { >+ // ignore >+ } >+ >+ @Override >+ public void restoreState(ContextMemento memento) { >+ ContextPerspectiveManager.this.restoreState(memento); >+ } >+ >+ @Override >+ public void saveState(ContextMemento memento) { >+ ContextPerspectiveManager.this.saveState(memento); >+ } >+ >+ } > > private final Set<String> managedPerspectiveIds; > >@@ -39,8 +64,11 @@ > > private final IPreferenceStore preferenceStore; > >+ private final MementoListener mementoListener; >+ > public ContextPerspectiveManager(IPreferenceStore preferenceStore) { > this.preferenceStore = preferenceStore; >+ this.mementoListener = new MementoListener(); > this.managedPerspectiveIds = new HashSet<String>(); > this.actionSetsToSuppress = new HashSet<String>(); > actionSetsToSuppress.add("org.eclipse.ui.edit.text.actionSet.annotationNavigation"); //$NON-NLS-1$ >@@ -56,72 +84,60 @@ > managedPerspectiveIds.remove(id); > } > >- public void taskActivated(ITask task) { >- try { >+ public void restoreState(ContextMemento state) { >+ if (PlatformUI.isWorkbenchRunning() && isEnabled()) { > IWorkbenchWindow launchingWindow = getWorkbenchWindow(); > if (launchingWindow != null) { >+ // save current perspective > IPerspectiveDescriptor descriptor = launchingWindow.getActivePage().getPerspective(); >- setPerspectiveIdFor(null, descriptor.getId()); >+ setDefaultPerspective(descriptor.getId()); > >- String perspectiveId = getPerspectiveIdFor(task); >- showPerspective(perspectiveId); >+ // restore perspective >+ IMemento memento = state.getMemento(MEMENTO_PERSPECTIVE); >+ if (memento != null) { >+ String perspectiveId = memento.getString(KEY_ACTIVE_ID); >+ showPerspective(perspectiveId); >+ } > } >- } catch (Exception e) { >- // ignore, perspective may not have been saved, e.g. due to crash > } > } > >- public void taskDeactivated(ITask task) { >- try { >- if (PlatformUI.isWorkbenchRunning() >- && ContextUiPlugin.getDefault().getPreferenceStore().getBoolean( >- IContextUiPreferenceContstants.AUTO_MANAGE_PERSPECTIVES)) { >- IWorkbenchWindow launchingWindow = getWorkbenchWindow(); >- if (launchingWindow != null) { >- IPerspectiveDescriptor descriptor = launchingWindow.getActivePage().getPerspective(); >- setPerspectiveIdFor(task, descriptor.getId()); >+ public void saveState(ContextMemento state) { >+ if (PlatformUI.isWorkbenchRunning() && isEnabled()) { >+ IWorkbenchWindow launchingWindow = getWorkbenchWindow(); >+ if (launchingWindow != null) { >+ IPerspectiveDescriptor descriptor = launchingWindow.getActivePage().getPerspective(); > >- String previousPerspectiveId = getPerspectiveIdFor(null); >- showPerspective(previousPerspectiveId); >- } >+ IMemento memento = state.createMemento(MEMENTO_PERSPECTIVE); >+ memento.putString(KEY_ACTIVE_ID, descriptor.getId()); >+ >+ String previousPerspectiveId = getDefaultPerspective(); >+ showPerspective(previousPerspectiveId); > } >- } catch (Exception e) { >- // ignore, perspective may not have been saved, e.g. due to crash > } > } > >+ private boolean isEnabled() { >+ return ContextUiPlugin.getDefault().getPreferenceStore().getBoolean( >+ IContextUiPreferenceContstants.AUTO_MANAGE_PERSPECTIVES); >+ } >+ > private void showPerspective(String perspectiveId) { >- if (perspectiveId != null >- && perspectiveId.length() > 0 >- && ContextUiPlugin.getDefault().getPreferenceStore().getBoolean( >- IContextUiPreferenceContstants.AUTO_MANAGE_PERSPECTIVES)) { >+ if (perspectiveId != null && perspectiveId.length() > 0) { > IWorkbenchWindow launchingWindow = getWorkbenchWindow(); >- try { >- if (launchingWindow != null) { >+ if (launchingWindow != null) { >+ try { > launchingWindow.getShell().setRedraw(false); > PlatformUI.getWorkbench().showPerspective(perspectiveId, launchingWindow); >- } >- } catch (Exception e) { >- // perspective's preserved id not found, ignore >- } finally { >- if (launchingWindow != null) { >+ } catch (Exception e) { >+ // perspective's preserved id not found, ignore >+ } finally { > launchingWindow.getShell().setRedraw(true); > } > } > } > } > >- public IWorkbenchWindow getWorkbenchWindow() { >- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); >- if (window == null) { >- IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows(); >- if (windows.length > 0) { >- window = windows[0]; >- } >- } >- return window; >- } >- > public void perspectivePreDeactivate(IWorkbenchPage page, IPerspectiveDescriptor perspective) { > // ignore > } >@@ -173,38 +189,31 @@ > // ignore > } > >- public void preTaskActivated(ITask task) { >- // ignore >+ private String getDefaultPerspective() { >+ return preferenceStore.getString(IContextUiPreferenceContstants.PERSPECTIVE_NO_ACTIVE_TASK); > } > >- public void preTaskDeactivated(ITask task) { >- // ignore >+ private void setDefaultPerspective(String perspectiveId) { >+ preferenceStore.setValue(IContextUiPreferenceContstants.PERSPECTIVE_NO_ACTIVE_TASK, perspectiveId); > } > >- /** >- * @param task >- * can be null to indicate no task >- */ >- private String getPerspectiveIdFor(ITask task) { >- if (task != null) { >- return preferenceStore.getString(IContextUiPreferenceContstants.PREFIX_TASK_TO_PERSPECTIVE >- + task.getHandleIdentifier()); >- } else { >- return preferenceStore.getString(IContextUiPreferenceContstants.PERSPECTIVE_NO_ACTIVE_TASK); >- } >+ public void start(ContextMementoManager mementoManager) { >+ mementoManager.addMementoListener(mementoListener); >+ } >+ >+ public void stop(ContextMementoManager mementoManager) { >+ mementoManager.removeMementoListener(mementoListener); > } > >- /** >- * @param task >- * can be null to indicate no task >- */ >- private void setPerspectiveIdFor(ITask task, String perspectiveId) { >- if (task != null) { >- preferenceStore.setValue(IContextUiPreferenceContstants.PREFIX_TASK_TO_PERSPECTIVE >- + task.getHandleIdentifier(), perspectiveId); >- } else { >- preferenceStore.setValue(IContextUiPreferenceContstants.PERSPECTIVE_NO_ACTIVE_TASK, perspectiveId); >+ public IWorkbenchWindow getWorkbenchWindow() { >+ IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); >+ if (window == null) { >+ IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows(); >+ if (windows.length > 0) { >+ window = windows[0]; >+ } > } >+ return window; > } > > } >Index: src/org/eclipse/mylyn/internal/context/ui/ContextUiPlugin.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.context.ui/src/org/eclipse/mylyn/internal/context/ui/ContextUiPlugin.java,v >retrieving revision 1.44 >diff -u -r1.44 ContextUiPlugin.java >--- src/org/eclipse/mylyn/internal/context/ui/ContextUiPlugin.java 13 Oct 2009 00:57:51 -0000 1.44 >+++ src/org/eclipse/mylyn/internal/context/ui/ContextUiPlugin.java 11 Dec 2009 06:27:44 -0000 >@@ -11,6 +11,9 @@ > > package org.eclipse.mylyn.internal.context.ui; > >+import java.io.File; >+import java.io.IOException; >+import java.io.StringReader; > import java.util.ArrayList; > import java.util.Collections; > import java.util.HashMap; >@@ -28,8 +31,11 @@ > import org.eclipse.core.runtime.IExtensionPoint; > import org.eclipse.core.runtime.IExtensionRegistry; > import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.MultiStatus; > import org.eclipse.core.runtime.Platform; > import org.eclipse.core.runtime.Status; >+import org.eclipse.core.runtime.preferences.IEclipsePreferences; >+import org.eclipse.core.runtime.preferences.InstanceScope; > import org.eclipse.jface.preference.IPreferenceStore; > import org.eclipse.jface.resource.ImageDescriptor; > import org.eclipse.jface.text.TextSelection; >@@ -46,6 +52,8 @@ > import org.eclipse.mylyn.context.core.IInteractionRelation; > import org.eclipse.mylyn.context.ui.AbstractContextUiBridge; > import org.eclipse.mylyn.context.ui.IContextUiStartup; >+import org.eclipse.mylyn.internal.context.core.ContextCorePlugin; >+import org.eclipse.mylyn.internal.context.core.InteractionContext; > import org.eclipse.mylyn.internal.context.ui.wizards.RetrieveLatestContextDialog; > import org.eclipse.mylyn.internal.provisional.commons.ui.WorkbenchUtil; > import org.eclipse.mylyn.monitor.ui.MonitorUi; >@@ -54,17 +62,23 @@ > import org.eclipse.mylyn.tasks.core.TaskActivationAdapter; > import org.eclipse.mylyn.tasks.ui.ITasksUiConstants; > import org.eclipse.mylyn.tasks.ui.TasksUi; >+import org.eclipse.osgi.util.NLS; > import org.eclipse.swt.graphics.Image; > import org.eclipse.ui.IEditorInput; > import org.eclipse.ui.IEditorPart; >+import org.eclipse.ui.IMemento; > import org.eclipse.ui.IViewPart; > import org.eclipse.ui.IViewReference; > import org.eclipse.ui.IWorkbench; > import org.eclipse.ui.IWorkbenchWindow; > import org.eclipse.ui.PlatformUI; >+import org.eclipse.ui.WorkbenchException; >+import org.eclipse.ui.XMLMemento; > import org.eclipse.ui.internal.WorkbenchPlugin; > import org.eclipse.ui.plugin.AbstractUIPlugin; >+import org.eclipse.ui.preferences.ScopedPreferenceStore; > import org.osgi.framework.BundleContext; >+import org.osgi.service.prefs.BackingStoreException; > > /** > * Main entry point for the Context UI. >@@ -75,6 +89,18 @@ > */ > public class ContextUiPlugin extends AbstractUIPlugin { > >+ /** >+ * Only intended for tests and migration. >+ */ >+ @Deprecated >+ public static final String PREFIX_TASK_TO_PERSPECTIVE = "org.eclipse.mylyn.ui.perspectives.task."; //$NON-NLS-1$ >+ >+ /** >+ * Only intended for tests and migration. >+ */ >+ @Deprecated >+ public static final String EDITOR_MEMENTO_PREFS_PREFIX = "editors.task."; //$NON-NLS-1$ >+ > public static final String ID_PLUGIN = "org.eclipse.mylyn.context.ui"; //$NON-NLS-1$ > > private class ContextActivationListener extends AbstractContextListener { >@@ -206,6 +232,8 @@ > > private ContextEditorManager editorManager; > >+ private ContextMementoManager mementoManager; >+ > public ContextUiPlugin() { > INSTANCE = this; > } >@@ -247,11 +275,22 @@ > ContextCore.getContextManager().addListener(viewerManager); > MonitorUi.addWindowPartListener(contentOutlineManager); > perspectiveManager.addManagedPerspective(ITasksUiConstants.ID_PERSPECTIVE_PLANNING); >- TasksUi.getTaskActivityManager().addActivationListener(perspectiveManager); >+ > MonitorUi.addWindowPerspectiveListener(perspectiveManager); > TasksUi.getTaskActivityManager().addActivationListener(TASK_ACTIVATION_LISTENER); > >- ContextCore.getContextManager().addListener(editorManager); >+ mementoManager = new ContextMementoManager(ContextCore.getContextManager(), getContextMementoPath()); >+ mementoManager.start(); >+ >+ editorManager = new ContextEditorManager(); >+ editorManager.start(ContextCore.getContextManager(), mementoManager); >+ >+ perspectiveManager.start(mementoManager); >+ >+ IStatus status = migrateContextMementos(); >+ if (!status.isOK()) { >+ StatusHandler.log(status); >+ } > } catch (Exception e) { > StatusHandler.log(new Status(IStatus.ERROR, ContextUiPlugin.ID_PLUGIN, "Context UI initialization failed", //$NON-NLS-1$ > e)); >@@ -283,15 +322,128 @@ > } > } > >+ /** >+ * Migrates editor mementos and perspective ids from the preferences to a memento based store in the file-system. >+ * <p> >+ * <b>Public for testing.</b> >+ * >+ * @since 3.4 >+ */ >+ public IStatus migrateContextMementos() { >+ MultiStatus status = new MultiStatus(ContextUiPlugin.ID_PLUGIN, 0, >+ "Errors migrating saved editors and perspective settings", null); //$NON-NLS-1$ >+ >+ ScopedPreferenceStore perspectivePreferenceStore = new ScopedPreferenceStore(new InstanceScope(), >+ "org.eclipse.mylyn.context.ui"); //$NON-NLS-1$ >+ ScopedPreferenceStore editorPreferenceStore = new ScopedPreferenceStore(new InstanceScope(), >+ "org.eclipse.mylyn.resources.ui"); //$NON-NLS-1$ >+ >+ // migrate editor mementos first >+ IEclipsePreferences[] perspectiveNodes = perspectivePreferenceStore.getPreferenceNodes(false); >+ IEclipsePreferences[] editorNodes = editorPreferenceStore.getPreferenceNodes(false); >+ if (editorNodes.length > 0) { >+ String[] keys; >+ try { >+ keys = editorNodes[0].keys(); >+ for (String key : keys) { >+ if (key.startsWith(EDITOR_MEMENTO_PREFS_PREFIX)) { >+ String contextHandle = key.substring(EDITOR_MEMENTO_PREFS_PREFIX.length()); >+ String mementoString = editorPreferenceStore.getString(key); >+ if (mementoString != null && !mementoString.trim().equals("")) { //$NON-NLS-1$ >+ try { >+ IMemento oldMemento = XMLMemento.createReadRoot(new StringReader(mementoString)); >+ InteractionContext context = new InteractionContext(contextHandle, >+ ContextCore.getCommonContextScaling()); >+ ContextMemento state = mementoManager.createMemento(context, contextHandle); >+ >+ // migrate editors >+ IMemento newMemnto = state.createMemento(ContextEditorManager.MEMENTO_EDITORS); >+ newMemnto.putMemento(oldMemento); >+ >+ // migrate perspective >+ String perspectiveId = perspectivePreferenceStore.getString(PREFIX_TASK_TO_PERSPECTIVE >+ + contextHandle); >+ if (perspectiveId != null) { >+ IMemento perspectiveMemento = state.createMemento(ContextPerspectiveManager.MEMENTO_PERSPECTIVE); >+ perspectiveMemento.putString(ContextPerspectiveManager.KEY_ACTIVE_ID, perspectiveId); >+ } >+ >+ mementoManager.write(state); >+ } catch (WorkbenchException e) { >+ status.add(new Status(IStatus.ERROR, ContextUiPlugin.ID_PLUGIN, NLS.bind( >+ "Migration of editor memento failed for {0}", contextHandle), e)); //$NON-NLS-1$ >+ } >+ } >+ editorNodes[0].remove(key); >+ if (perspectiveNodes.length > 0) { >+ perspectiveNodes[0].remove(PREFIX_TASK_TO_PERSPECTIVE + contextHandle); >+ } >+ } >+ } >+ } catch (BackingStoreException e) { >+ status.add(new Status(IStatus.ERROR, ContextUiPlugin.ID_PLUGIN, "Reading of editor mementos failed", e)); //$NON-NLS-1$ >+ } >+ } >+ >+ // migrate remaining perspective mementos >+ if (perspectiveNodes.length > 0) { >+ try { >+ String[] keys = perspectiveNodes[0].keys(); >+ for (String key : keys) { >+ if (key.startsWith(PREFIX_TASK_TO_PERSPECTIVE) >+ && !key.equals(IContextUiPreferenceContstants.PERSPECTIVE_NO_ACTIVE_TASK)) { >+ String contextHandle = key.substring(PREFIX_TASK_TO_PERSPECTIVE.length()); >+ String perspectiveId = perspectivePreferenceStore.getString(key); >+ if (perspectiveId != null && perspectiveId.length() > 0) { >+ InteractionContext context = new InteractionContext(contextHandle, >+ ContextCore.getCommonContextScaling()); >+ ContextMemento state = mementoManager.createMemento(context, contextHandle); >+ >+ // migrate perspective >+ IMemento perspectiveMemento = state.createMemento(ContextPerspectiveManager.MEMENTO_PERSPECTIVE); >+ perspectiveMemento.putString(ContextPerspectiveManager.KEY_ACTIVE_ID, perspectiveId); >+ >+ mementoManager.write(state); >+ } >+ perspectiveNodes[0].remove(key); >+ } >+ } >+ } catch (BackingStoreException e) { >+ status.add(new Status(IStatus.ERROR, ContextUiPlugin.ID_PLUGIN, >+ "Reading of perspective mementos failed", e)); //$NON-NLS-1$ >+ } >+ } >+ >+ try { >+ editorPreferenceStore.save(); >+ } catch (IOException e) { >+ status.add(new Status(IStatus.ERROR, ContextUiPlugin.ID_PLUGIN, "Saving of preference store failed", e)); //$NON-NLS-1$ >+ } >+ try { >+ perspectivePreferenceStore.save(); >+ } catch (IOException e) { >+ status.add(new Status(IStatus.ERROR, ContextUiPlugin.ID_PLUGIN, "Saving of preference store failed", e)); //$NON-NLS-1$ >+ } >+ >+ return status; >+ } >+ > private void lazyStop() { > if (editorManager != null) { >- ContextCore.getContextManager().removeListener(editorManager); >+ editorManager.stop(ContextCore.getContextManager(), mementoManager); >+ } >+ >+ if (perspectiveManager != null) { >+ perspectiveManager.stop(mementoManager); >+ } >+ >+ if (mementoManager != null) { >+ mementoManager.stop(); > } > > ContextCore.getContextManager().removeListener(viewerManager); > MonitorUi.removeWindowPartListener(contentOutlineManager); > >- TasksUi.getTaskActivityManager().removeActivationListener(perspectiveManager); > MonitorUi.removeWindowPerspectiveListener(perspectiveManager); > TasksUi.getTaskActivityManager().removeActivationListener(TASK_ACTIVATION_LISTENER); > } >@@ -639,4 +791,13 @@ > public static ContextPerspectiveManager getPerspectiveManager() { > return INSTANCE.perspectiveManager; > } >+ >+ public File getContextMementoPath() { >+ return new File(ContextCorePlugin.getContextStore().getContextDirectory(), "workbench"); //$NON-NLS-1$ >+ } >+ >+ public ContextMementoManager getMementoManager() { >+ return mementoManager; >+ } >+ > } >Index: src/org/eclipse/mylyn/internal/context/ui/IContextUiPreferenceContstants.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.context.ui/src/org/eclipse/mylyn/internal/context/ui/IContextUiPreferenceContstants.java,v >retrieving revision 1.4 >diff -u -r1.4 IContextUiPreferenceContstants.java >--- src/org/eclipse/mylyn/internal/context/ui/IContextUiPreferenceContstants.java 3 Dec 2008 03:14:20 -0000 1.4 >+++ src/org/eclipse/mylyn/internal/context/ui/IContextUiPreferenceContstants.java 11 Dec 2009 06:27:44 -0000 >@@ -30,6 +30,4 @@ > > public static final String PERSPECTIVE_NO_ACTIVE_TASK = "org.eclipse.mylyn.ui.perspectives.task.none"; //$NON-NLS-1$ > >- public static final String PREFIX_TASK_TO_PERSPECTIVE = "org.eclipse.mylyn.ui.perspectives.task."; //$NON-NLS-1$ >- > } >Index: src/org/eclipse/mylyn/internal/context/ui/commands/CopyContextHandler.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.context.ui/src/org/eclipse/mylyn/internal/context/ui/commands/CopyContextHandler.java,v >retrieving revision 1.9 >diff -u -r1.9 CopyContextHandler.java >--- src/org/eclipse/mylyn/internal/context/ui/commands/CopyContextHandler.java 7 Oct 2009 23:15:05 -0000 1.9 >+++ src/org/eclipse/mylyn/internal/context/ui/commands/CopyContextHandler.java 11 Dec 2009 06:27:44 -0000 >@@ -66,7 +66,7 @@ > MessageDialog.openInformation(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), > TITLE_DIALOG, Messages.CopyContextHandler_SOURCE_TASK_DOES_HAVE_A_CONTEXT); > } else { >- ContextUiPlugin.getEditorManager().copyEditorMemento(sourceTask.getHandleIdentifier(), >+ ContextUiPlugin.getDefault().getMementoManager().copy(sourceTask.getHandleIdentifier(), > targetTask.getHandleIdentifier()); > TasksUiInternal.activateTaskThroughCommand(targetTask); > } >#P org.eclipse.mylyn.monitor.ui >Index: src/org/eclipse/mylyn/internal/monitor/ui/ActivityContextManager.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.monitor.ui/src/org/eclipse/mylyn/internal/monitor/ui/ActivityContextManager.java,v >retrieving revision 1.26 >diff -u -r1.26 ActivityContextManager.java >--- src/org/eclipse/mylyn/internal/monitor/ui/ActivityContextManager.java 10 Dec 2009 05:17:14 -0000 1.26 >+++ src/org/eclipse/mylyn/internal/monitor/ui/ActivityContextManager.java 11 Dec 2009 06:27:45 -0000 >@@ -33,6 +33,7 @@ > import org.eclipse.mylyn.monitor.ui.AbstractUserActivityMonitor; > import org.eclipse.mylyn.monitor.ui.IActivityContextManager; > import org.eclipse.mylyn.monitor.ui.IUserAttentionListener; >+import org.eclipse.osgi.util.NLS; > import org.eclipse.ui.IWorkbenchPage; > import org.eclipse.ui.IWorkbenchWindow; > import org.eclipse.ui.IWorkingSet; >@@ -244,8 +245,8 @@ > } > > private void disableFailedMonitor(AbstractUserActivityMonitor monitor, Throwable e) { >- StatusHandler.log(new Status(IStatus.WARNING, ContextCorePlugin.ID_PLUGIN, >- "Activity monitor ''{0}'' was disabled due to a failure")); //$NON-NLS-1$ >+ StatusHandler.log(new Status(IStatus.WARNING, ContextCorePlugin.ID_PLUGIN, NLS.bind( >+ "Activity monitor ''{0}'' was disabled due to a failure", monitor.getClass().getName()), e)); //$NON-NLS-1$ > activityMonitors.remove(monitor); > } > >#P org.eclipse.mylyn.tasks.core >#P org.eclipse.mylyn.tasks.tests >Index: src/org/eclipse/mylyn/tasks/tests/TaskDataExportTest.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskDataExportTest.java,v >retrieving revision 1.43 >diff -u -r1.43 TaskDataExportTest.java >--- src/org/eclipse/mylyn/tasks/tests/TaskDataExportTest.java 10 Dec 2009 02:32:50 -0000 1.43 >+++ src/org/eclipse/mylyn/tasks/tests/TaskDataExportTest.java 11 Dec 2009 06:27:48 -0000 >@@ -100,6 +100,10 @@ > CommonTestUtil.deleteFolder(destinationDir); > createDirectory(destinationDir.getParentFile(), destinationDir.getName()); > >+ // clean up contexts and offline data >+ CommonTestUtil.deleteFolder(new File(mylynFolder, "contexts")); >+ CommonTestUtil.deleteFolder(new File(mylynFolder, "tasks")); >+ > // Create folder/file structure > createFile(mylynFolder, "tasks.xml.zip"); > createFile(mylynFolder, "tasklist.xml.zip"); >Index: src/org/eclipse/mylyn/tasks/tests/TaskRepositoryManagerTest.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskRepositoryManagerTest.java,v >retrieving revision 1.43 >diff -u -r1.43 TaskRepositoryManagerTest.java >--- src/org/eclipse/mylyn/tasks/tests/TaskRepositoryManagerTest.java 13 Oct 2009 00:58:06 -0000 1.43 >+++ src/org/eclipse/mylyn/tasks/tests/TaskRepositoryManagerTest.java 11 Dec 2009 06:27:48 -0000 >@@ -234,7 +234,7 @@ > //manager.readRepositories(TasksUiPlugin.getDefault().getRepositoriesFilePath()); > > if (manager.getRepositoryConnector("bugzilla") != null) { >- assertTrue(manager.getAllRepositories().contains(repository2)); >+ assertTrue(manager.getAllRepositories().contains(repository1)); > } > if (manager.getRepositoryConnector("jira") != null) { > assertTrue(manager.getAllRepositories().contains(repository2)); >Index: src/org/eclipse/mylyn/tasks/tests/ui/ContextPerspectiveManagerTest.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/ui/ContextPerspectiveManagerTest.java,v >retrieving revision 1.8 >diff -u -r1.8 ContextPerspectiveManagerTest.java >--- src/org/eclipse/mylyn/tasks/tests/ui/ContextPerspectiveManagerTest.java 8 Dec 2009 01:43:27 -0000 1.8 >+++ src/org/eclipse/mylyn/tasks/tests/ui/ContextPerspectiveManagerTest.java 11 Dec 2009 06:27:48 -0000 >@@ -11,14 +11,23 @@ > > package org.eclipse.mylyn.tasks.tests.ui; > >+import java.util.Collections; >+ > import junit.framework.TestCase; > >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.mylyn.context.core.ContextCore; > import org.eclipse.mylyn.context.tests.support.ContextTestUtil; >+import org.eclipse.mylyn.internal.context.core.InteractionContext; >+import org.eclipse.mylyn.internal.context.ui.ContextMemento; > import org.eclipse.mylyn.internal.context.ui.ContextUiPlugin; > import org.eclipse.mylyn.internal.context.ui.IContextUiPreferenceContstants; > import org.eclipse.mylyn.internal.tasks.core.TaskTask; >+import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin; >+import org.eclipse.mylyn.internal.tasks.ui.actions.DeleteAction; > import org.eclipse.mylyn.tasks.tests.TaskTestUtil; > import org.eclipse.mylyn.tasks.ui.TasksUi; >+import org.eclipse.ui.IMemento; > import org.eclipse.ui.IWorkbenchWindow; > import org.eclipse.ui.PlatformUI; > >@@ -42,6 +51,8 @@ > IContextUiPreferenceContstants.AUTO_MANAGE_PERSPECTIVES); > ContextUiPlugin.getDefault().getPreferenceStore().setValue( > IContextUiPreferenceContstants.AUTO_MANAGE_PERSPECTIVES, true); >+ >+ ContextUiPlugin.getDefault().getMementoManager().flushPending(); > } > > @Override >@@ -51,6 +62,18 @@ > TaskTestUtil.resetTaskListAndRepositories(); > } > >+ public void testHasPlanningAndResourcePerspective() throws Exception { >+ PlatformUI.getWorkbench().showPerspective(ID_RESOURCE_PERSPECTIVE, getWorkbenchWindow()); >+ assertEquals(ID_RESOURCE_PERSPECTIVE, getActivePerspective()); >+ PlatformUI.getWorkbench().showPerspective(ID_PLANNING_PERSPECTIVE, getWorkbenchWindow()); >+ assertEquals(ID_PLANNING_PERSPECTIVE, getActivePerspective()); >+ } >+ >+ public void testHasActiveWorkbenchWindow() throws Exception { >+ assertNotNull("No active workbench window. Following tests are likely to fail.", PlatformUI.getWorkbench() >+ .getActiveWorkbenchWindow()); >+ } >+ > public void testRestorePerspective() throws Exception { > PlatformUI.getWorkbench().showPerspective(ID_RESOURCE_PERSPECTIVE, getWorkbenchWindow()); > assertEquals(ID_RESOURCE_PERSPECTIVE, getActivePerspective()); >@@ -71,24 +94,47 @@ > assertEquals(ID_PLANNING_PERSPECTIVE, getActivePerspective()); > } > >- // FIXME 3.4 re-enable test >-// public void testRecreateTask() throws Exception { >-// PlatformUI.getWorkbench().showPerspective(ID_RESOURCE_PERSPECTIVE, MonitorUi.getLaunchingWorkbenchWindow()); >-// TaskTask task = TaskTestUtil.createMockTask("1"); >-// >-// // check that deleting task switches back to original perspective >-// TasksUi.getTaskActivityManager().activateTask(task); >-// PlatformUI.getWorkbench().showPerspective(ID_PLANNING_PERSPECTIVE, MonitorUi.getLaunchingWorkbenchWindow()); >-// TasksUiPlugin.getTaskActivityManager().deactivateActiveTask(); >-// TasksUiPlugin.getTaskList().deleteTask(task); >-// assertEquals(ID_RESOURCE_PERSPECTIVE, getActivePerspective()); >-// >-// task = TaskTestUtil.createMockTask("1"); >-// >-// // check that activating new task with the same id does not switch the perspective >-// TasksUi.getTaskActivityManager().activateTask(task); >-// assertEquals(ID_RESOURCE_PERSPECTIVE, getActivePerspective()); >-// } >+ public void testRecreateTask() throws Exception { >+ PlatformUI.getWorkbench().showPerspective(ID_RESOURCE_PERSPECTIVE, getWorkbenchWindow()); >+ TaskTask task = TaskTestUtil.createMockTask("1"); >+ TasksUiPlugin.getTaskList().addTask(task); >+ >+ // check that deleting task switches back to original perspective >+ TasksUi.getTaskActivityManager().activateTask(task); >+ PlatformUI.getWorkbench().showPerspective(ID_PLANNING_PERSPECTIVE, getWorkbenchWindow()); >+ TasksUiPlugin.getTaskActivityManager().deactivateActiveTask(); >+ // XXX ensure that InteractionContextManager is notified, TasksUiPlugin.getTaskList().deleteTask(task) does not do that >+ DeleteAction.performDeletion(Collections.singleton(task)); >+ assertEquals(ID_RESOURCE_PERSPECTIVE, getActivePerspective()); >+ >+ task = TaskTestUtil.createMockTask("1"); >+ >+ // check that activating new task with the same id does not switch the perspective >+ TasksUi.getTaskActivityManager().activateTask(task); >+ assertEquals(ID_RESOURCE_PERSPECTIVE, getActivePerspective()); >+ } >+ >+ @SuppressWarnings("deprecation") >+ public void testMigratePreferences() throws Exception { >+ PlatformUI.getWorkbench().showPerspective(ID_RESOURCE_PERSPECTIVE, getWorkbenchWindow()); >+ >+ TaskTask task = TaskTestUtil.createMockTask("1"); >+ ContextUiPlugin.getDefault().getPreferenceStore().setValue( >+ ContextUiPlugin.PREFIX_TASK_TO_PERSPECTIVE + task.getHandleIdentifier(), ID_PLANNING_PERSPECTIVE); >+ >+ IStatus status = ContextUiPlugin.getDefault().migrateContextMementos(); >+ assertEquals(IStatus.OK, status.getSeverity()); >+ >+ InteractionContext context = new InteractionContext(task.getHandleIdentifier(), >+ ContextCore.getCommonContextScaling()); >+ ContextMemento state = ContextUiPlugin.getDefault().getMementoManager().read(context); >+ IMemento memento = state.getMemento("org.eclipse.mylyn.context.ui.perspectives"); >+ assertNotNull(memento); >+ assertEquals(ID_PLANNING_PERSPECTIVE, memento.getString("activeId")); >+ >+ assertEquals("", ContextUiPlugin.getDefault().getPreferenceStore().getString( >+ ContextUiPlugin.PREFIX_TASK_TO_PERSPECTIVE + task.getHandleIdentifier())); >+ } > > private IWorkbenchWindow getWorkbenchWindow() { > IWorkbenchWindow window = ContextUiPlugin.getPerspectiveManager().getWorkbenchWindow(); >#P org.eclipse.mylyn.tasks.ui >Index: src/org/eclipse/mylyn/internal/tasks/ui/RefactorRepositoryUrlOperation.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/RefactorRepositoryUrlOperation.java,v >retrieving revision 1.17 >diff -u -r1.17 RefactorRepositoryUrlOperation.java >--- src/org/eclipse/mylyn/internal/tasks/ui/RefactorRepositoryUrlOperation.java 24 Jul 2009 12:05:46 -0000 1.17 >+++ src/org/eclipse/mylyn/internal/tasks/ui/RefactorRepositoryUrlOperation.java 11 Dec 2009 06:27:49 -0000 >@@ -14,14 +14,18 @@ > import java.io.File; > import java.lang.reflect.InvocationTargetException; > import java.net.URLDecoder; >+import java.util.ArrayList; >+import java.util.List; > > import org.eclipse.core.runtime.Assert; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.IProgressMonitor; > import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.MultiStatus; > import org.eclipse.core.runtime.Status; > import org.eclipse.mylyn.commons.core.StatusHandler; > import org.eclipse.mylyn.internal.context.core.ContextCorePlugin; >+import org.eclipse.mylyn.internal.context.core.ContextUtil; > import org.eclipse.mylyn.internal.context.core.InteractionContext; > import org.eclipse.mylyn.internal.context.core.InteractionContextManager; > import org.eclipse.mylyn.internal.tasks.core.ITasksCoreConstants; >@@ -29,6 +33,7 @@ > import org.eclipse.mylyn.internal.tasks.core.data.TaskDataManager; > import org.eclipse.mylyn.monitor.core.InteractionEvent; > import org.eclipse.mylyn.tasks.core.ITask; >+import org.eclipse.osgi.util.NLS; > > /** > * @author Rob Elves >@@ -51,49 +56,60 @@ > @Override > protected void operations(IProgressMonitor monitor) throws CoreException, InvocationTargetException, > InterruptedException { >+ List<IStatus> result = new ArrayList<IStatus>(); > try { >- //TasksUiPlugin.getTaskListManager().deactivateAllTasks(); > monitor.beginTask(Messages.RefactorRepositoryUrlOperation_Repository_URL_update, IProgressMonitor.UNKNOWN); >+ >+ //TasksUiPlugin.getTaskListManager().deactivateAllTasks(); > refactorOfflineHandles(oldUrl, newUrl); > getTaskList().refactorRepositoryUrl(oldUrl, newUrl); >+ > refactorMetaContextHandles(oldUrl, newUrl); >- refactorContextFileNames(); >+ File contextDir = TasksUiPlugin.getDefault().getContextStoreDir(); >+ refactorContextFileNames(contextDir, ".xml", result); //$NON-NLS-1$ >+ refactorContextFileNames(new File(contextDir, "workbench"), ".xml", result); //$NON-NLS-1$ //$NON-NLS-2$ >+ > TasksUiPlugin.getTaskActivityMonitor().reloadActivityTime(); > } finally { > monitor.done(); > } >+ if (!result.isEmpty()) { >+ StatusHandler.log(new MultiStatus(TasksUiPlugin.ID_PLUGIN, 0, result.toArray(new IStatus[0]), NLS.bind( >+ "Problems occured while changing URL from ''{0}'' to ''{1}''", oldUrl, newUrl), null)); //$NON-NLS-1$ >+ } > } > >- @SuppressWarnings("restriction") >- public void refactorContextFileNames() { >- >- File dataDir = new File(TasksUiPlugin.getDefault().getDataDirectory(), ITasksCoreConstants.CONTEXTS_DIRECTORY); >+ public void refactorContextFileNames(File dataDir, String extension, List<IStatus> result) { > if (dataDir.exists() && dataDir.isDirectory()) { > File[] files = dataDir.listFiles(); > if (files != null) { > for (File file : dataDir.listFiles()) { >- int dotIndex = file.getName().lastIndexOf(".xml"); //$NON-NLS-1$ >- if (dotIndex != -1) { >- String storedHandle; >- try { >- storedHandle = URLDecoder.decode(file.getName().substring(0, dotIndex), >- InteractionContextManager.CONTEXT_FILENAME_ENCODING); >- int delimIndex = storedHandle.lastIndexOf(RepositoryTaskHandleUtil.HANDLE_DELIM); >- if (delimIndex != -1) { >- String storedUrl = storedHandle.substring(0, delimIndex); >- if (oldUrl.equals(storedUrl)) { >- String id = RepositoryTaskHandleUtil.getTaskId(storedHandle); >- String newHandle = RepositoryTaskHandleUtil.getHandle(newUrl, id); >- File newFile = ContextCorePlugin.getContextStore().getFileForContext(newHandle); >- file.renameTo(newFile); >- } >- } >- } catch (Exception e) { >- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, >- "Could not move context file: " + file.getName(), e)); //$NON-NLS-1$ >- } >+ refactorContextFile(file, extension, result); >+ } >+ } >+ } >+ } >+ >+ private void refactorContextFile(File file, String extension, List<IStatus> result) { >+ int dotIndex = file.getName().lastIndexOf(extension); >+ if (dotIndex != -1) { >+ String storedHandle; >+ try { >+ storedHandle = URLDecoder.decode(file.getName().substring(0, dotIndex), >+ InteractionContextManager.CONTEXT_FILENAME_ENCODING); >+ int delimIndex = storedHandle.lastIndexOf(RepositoryTaskHandleUtil.HANDLE_DELIM); >+ if (delimIndex != -1) { >+ String storedUrl = storedHandle.substring(0, delimIndex); >+ if (oldUrl.equals(storedUrl)) { >+ String id = RepositoryTaskHandleUtil.getTaskId(storedHandle); >+ String newHandle = RepositoryTaskHandleUtil.getHandle(newUrl, id); >+ File newFile = new File(file.getParentFile(), ContextUtil.encodeHandle(newHandle) + extension); >+ file.renameTo(newFile); > } > } >+ } catch (Exception e) { >+ result.add(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, >+ "Could not move context file: " + file.getName(), e)); //$NON-NLS-1$ > } > } > } >Index: src/org/eclipse/mylyn/internal/tasks/ui/TasksUiPlugin.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksUiPlugin.java,v >retrieving revision 1.126 >diff -u -r1.126 TasksUiPlugin.java >--- src/org/eclipse/mylyn/internal/tasks/ui/TasksUiPlugin.java 2 Dec 2009 20:03:52 -0000 1.126 >+++ src/org/eclipse/mylyn/internal/tasks/ui/TasksUiPlugin.java 11 Dec 2009 06:27:49 -0000 >@@ -852,7 +852,7 @@ > } > } > >- private File getContextStoreDir() { >+ public File getContextStoreDir() { > File storeFile = new File(getDataDirectory(), ITasksCoreConstants.CONTEXTS_DIRECTORY); > if (!storeFile.exists()) { > storeFile.mkdirs();
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 226618
:
123033
|
123034
|
123040
|
123142
|
135417
|
152557
|
152558
|
153653
|
154288