aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemy Suen2011-07-12 07:51:44 (EDT)
committerPaul Webster2011-08-25 10:21:50 (EDT)
commit0952351f68e3c73e3fb17dbaccf309feb220928d (patch)
tree347a9bdaa6125574d0f9245618d463b00a63d786
parent8da5094955b5e652fa06c25df3a9ea76fe0afe53 (diff)
downloadeclipse.platform.ui-0952351f68e3c73e3fb17dbaccf309feb220928d.zip
eclipse.platform.ui-0952351f68e3c73e3fb17dbaccf309feb220928d.tar.gz
eclipse.platform.ui-0952351f68e3c73e3fb17dbaccf309feb220928d.tar.bz2
Bug 340088 [Compatibility] Investigate API tooling errors on 4.1
against 3.7 baseline Backport over two missing APIs for IWorkingSetManager that are causing API tooling errors.
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkingSetManager.java19
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AbstractWorkingSetManager.java27
2 files changed, 44 insertions, 2 deletions
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkingSetManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkingSetManager.java
index 222dc2a..79a2d92 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkingSetManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkingSetManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -350,4 +350,21 @@ public interface IWorkingSetManager {
* @since 3.4
*/
public void addToWorkingSets(IAdaptable element, IWorkingSet[] workingSets);
+
+ /**
+ * Sets maximum length of the recent working sets list.
+ *
+ * @param length
+ * maximum number of recent working sets to be kept in the list
+ * @since 3.7
+ */
+ public void setRecentWorkingSetsLength(int length);
+
+ /**
+ * Returns the maximum length of the recent working sets list.
+ *
+ * @return the maximum length of the recent working sets list.
+ * @since 3.7
+ */
+ public int getRecentWorkingSetsLength();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AbstractWorkingSetManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AbstractWorkingSetManager.java
index 72e7c15..92584ee 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AbstractWorkingSetManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AbstractWorkingSetManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -39,6 +39,7 @@ import org.eclipse.core.runtime.dynamichelpers.ExtensionTracker;
import org.eclipse.core.runtime.dynamichelpers.IExtensionChangeHandler;
import org.eclipse.core.runtime.dynamichelpers.IExtensionTracker;
import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.osgi.util.NLS;
@@ -47,6 +48,7 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IElementFactory;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.IPersistableElement;
+import org.eclipse.ui.IWorkbenchPreferenceConstants;
import org.eclipse.ui.IWorkingSet;
import org.eclipse.ui.IWorkingSetElementAdapter;
import org.eclipse.ui.IWorkingSetManager;
@@ -64,6 +66,7 @@ import org.eclipse.ui.internal.misc.StatusUtil;
import org.eclipse.ui.internal.registry.IWorkbenchRegistryConstants;
import org.eclipse.ui.internal.registry.WorkingSetDescriptor;
import org.eclipse.ui.internal.registry.WorkingSetRegistry;
+import org.eclipse.ui.internal.util.PrefUtil;
import org.eclipse.ui.progress.WorkbenchJob;
import org.eclipse.ui.statushandlers.StatusManager;
import org.osgi.framework.Bundle;
@@ -909,4 +912,26 @@ public abstract class AbstractWorkingSetManager extends EventManager implements
}});
}
}
+
+ public void setRecentWorkingSetsLength(int length) {
+ if (length < 1 || length > 99)
+ throw new IllegalArgumentException("Invalid recent working sets length: " + length); //$NON-NLS-1$
+ IPreferenceStore store = PrefUtil.getAPIPreferenceStore();
+ store.setValue(IWorkbenchPreferenceConstants.RECENTLY_USED_WORKINGSETS_SIZE, length);
+ // adjust length
+ sizeRecentWorkingSets();
+ }
+
+ private void sizeRecentWorkingSets() {
+ int maxLength = getRecentWorkingSetsLength();
+ while (recentWorkingSets.size() > maxLength) {
+ int lastPosition = recentWorkingSets.size() - 1;
+ recentWorkingSets.remove(lastPosition);
+ }
+ }
+
+ public int getRecentWorkingSetsLength() {
+ IPreferenceStore store = PrefUtil.getAPIPreferenceStore();
+ return store.getInt(IWorkbenchPreferenceConstants.RECENTLY_USED_WORKINGSETS_SIZE);
+ }
}