Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Goldthorpe2008-10-20 22:54:50 +0000
committerChris Goldthorpe2008-10-20 22:54:50 +0000
commite753cf1510e2876b877134b685e3ca9a7a469b97 (patch)
treeec5c7a2ca5032766aa94bc34ced316166c3e808a /org.eclipse.ui.cheatsheets
parent3ef6cceb0f0e3dd8a0ff7e8dd4235d83138061d7 (diff)
downloadeclipse.platform.ua-e753cf1510e2876b877134b685e3ca9a7a469b97.tar.gz
eclipse.platform.ua-e753cf1510e2876b877134b685e3ca9a7a469b97.tar.xz
eclipse.platform.ua-e753cf1510e2876b877134b685e3ca9a7a469b97.zip
Fix API warnings in CheatSheetCollectionElementv20081020
Diffstat (limited to 'org.eclipse.ui.cheatsheets')
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/dialogs/CheatSheetCategoryBasedSelectionDialog.java5
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetCollectionElement.java29
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetRegistryReader.java13
3 files changed, 30 insertions, 17 deletions
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/dialogs/CheatSheetCategoryBasedSelectionDialog.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/dialogs/CheatSheetCategoryBasedSelectionDialog.java
index 77039986b..ea472feee 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/dialogs/CheatSheetCategoryBasedSelectionDialog.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/dialogs/CheatSheetCategoryBasedSelectionDialog.java
@@ -482,13 +482,16 @@ public class CheatSheetCategoryBasedSelectionDialog extends TrayDialog //extends
return new BaseWorkbenchContentProvider() {
public Object[] getChildren(Object o) {
Object[] cheatsheets;
+ Object[] subCategories;
if (o instanceof CheatSheetCollectionElement) {
cheatsheets = ((CheatSheetCollectionElement) o)
.getCheatSheets();
+ subCategories = ((CheatSheetCollectionElement) o).getChildren();
} else {
cheatsheets = new Object[0];
+ subCategories = new Object[0];
}
- Object[] subCategories = super.getChildren(o);
+
if (cheatsheets.length == 0) {
return subCategories;
} else if (subCategories.length == 0) {
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetCollectionElement.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetCollectionElement.java
index 926be793c..f3748c5fc 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetCollectionElement.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetCollectionElement.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation and others.
+ * Copyright (c) 2002, 2008 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
@@ -10,24 +10,28 @@
*******************************************************************************/
package org.eclipse.ui.internal.cheatsheets.registry;
+import java.util.ArrayList;
import java.util.Iterator;
+import java.util.List;
import org.eclipse.core.runtime.*;
import org.eclipse.ui.IPluginContribution;
import org.eclipse.ui.internal.cheatsheets.ICheatSheetResource;
import org.eclipse.ui.model.AdaptableList;
import org.eclipse.ui.model.IWorkbenchAdapter;
+import org.eclipse.ui.model.WorkbenchAdapter;
/**
* Instances of this class are a collection of CheatSheetCollectionElements,
* thereby facilitating the definition of tree structures composed of
* these elements. Instances also store a list of cheatsheets.
*/
-public class CheatSheetCollectionElement extends AdaptableList implements IPluginContribution {
+public class CheatSheetCollectionElement extends WorkbenchAdapter implements IPluginContribution {
private String pluginId;
private String id;
private String name;
private CheatSheetCollectionElement parent;
private AdaptableList cheatsheets = new AdaptableList();
+ private List childCollections = new ArrayList();
/**
* Creates a new <code>CheatSheetCollectionElement</code>. Parent can be null.
@@ -44,13 +48,12 @@ public class CheatSheetCollectionElement extends AdaptableList implements IPlugi
/**
* Adds a cheatsheet collection to this collection.
*/
- public AdaptableList add(IAdaptable a) {
+ public void add(IAdaptable a) {
if (a instanceof CheatSheetElement) {
cheatsheets.add(a);
} else {
- super.add(a);
+ childCollections.add(a);
}
- return this;
}
/**
@@ -62,7 +65,7 @@ public class CheatSheetCollectionElement extends AdaptableList implements IPlugi
* @return CheatSheetCollectionElement
*/
public CheatSheetCollectionElement findChildCollection(IPath searchPath) {
- Object[] children = getChildren(null);
+ Object[] children = getChildren();
String searchString = searchPath.segment(0);
for (int i = 0; i < children.length; ++i) {
CheatSheetCollectionElement currentCategory = (CheatSheetCollectionElement) children[i];
@@ -90,7 +93,7 @@ public class CheatSheetCollectionElement extends AdaptableList implements IPlugi
}
if (!recursive)
return null;
- for (Iterator iterator = children.iterator(); iterator.hasNext();) {
+ for (Iterator iterator = childCollections.iterator(); iterator.hasNext();) {
CheatSheetCollectionElement child = (CheatSheetCollectionElement) iterator.next();
CheatSheetElement result = child.findCheatSheet(searchId, true);
if (result != null)
@@ -153,7 +156,7 @@ public class CheatSheetCollectionElement extends AdaptableList implements IPlugi
* Returns true if this element has no children and no cheatsheets.
*/
public boolean isEmpty() {
- return size() == 0 && cheatsheets.size() == 0;
+ return childCollections.size() == 0 && cheatsheets.size() == 0;
}
/**
@@ -175,7 +178,7 @@ public class CheatSheetCollectionElement extends AdaptableList implements IPlugi
*/
public String toString() {
StringBuffer buf = new StringBuffer("CheatSheetCollection, "); //$NON-NLS-1$
- buf.append(children.size());
+ buf.append(childCollections.size());
buf.append(" children, "); //$NON-NLS-1$
buf.append(cheatsheets.size());
buf.append(" cheatsheets"); //$NON-NLS-1$
@@ -189,4 +192,12 @@ public class CheatSheetCollectionElement extends AdaptableList implements IPlugi
public String getPluginId() {
return pluginId;
}
+
+ public Object[] getChildren() {
+ return childCollections.toArray();
+ }
+
+ public void add(CheatSheetCollectionElement newElement) {
+ childCollections.add(newElement);
+ }
}
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetRegistryReader.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetRegistryReader.java
index 2a073d62e..8bea4bfe8 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetRegistryReader.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetRegistryReader.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation and others.
+ * Copyright (c) 2002, 2008 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
@@ -20,7 +20,6 @@ import java.util.StringTokenizer;
import org.eclipse.core.runtime.*;
import org.eclipse.ui.internal.cheatsheets.*;
-import org.eclipse.ui.model.AdaptableList;
/**
* Instances access the registry that is provided at creation time
@@ -164,7 +163,7 @@ public class CheatSheetRegistryReader extends RegistryReader implements IRegistr
}
protected ArrayList cheatsheetItemExtensions;
- protected AdaptableList cheatsheets;
+ protected CheatSheetCollectionElement cheatsheets;
private ArrayList deferCategories = null;
private ArrayList deferCheatSheets = null;
private final String csItemExtension = "cheatSheetItemExtension"; //$NON-NLS-1$
@@ -185,7 +184,7 @@ public class CheatSheetRegistryReader extends RegistryReader implements IRegistr
* <code>readCheatSheets</code>.
* </p>
*/
- protected void addNewElementToResult(CheatSheetElement element, IConfigurationElement config, AdaptableList result) {
+ protected void addNewElementToResult(CheatSheetElement element, IConfigurationElement config, CheatSheetCollectionElement cheatsheets2) {
deferCheatSheet(element);
}
@@ -229,7 +228,7 @@ public class CheatSheetRegistryReader extends RegistryReader implements IRegistr
* Creates empty element collection. Overrider to fill
* initial elements, if needed.
*/
- protected AdaptableList createEmptyCheatSheetCollection() {
+ protected CheatSheetCollectionElement createEmptyCheatSheetCollection() {
return new CheatSheetCollectionElement(null, "root", "root", null); //$NON-NLS-1$//$NON-NLS-2$
}
@@ -385,7 +384,7 @@ public class CheatSheetRegistryReader extends RegistryReader implements IRegistr
* @param extension
* @param currentResult CheatSheetCollectionElement
*/
- private void finishCheatSheet(CheatSheetElement element, IConfigurationElement config, AdaptableList result) {
+ private void finishCheatSheet(CheatSheetElement element, IConfigurationElement config, CheatSheetCollectionElement result) {
CheatSheetCollectionElement currentResult = (CheatSheetCollectionElement) result;
StringTokenizer familyTokenizer = new StringTokenizer(getCategoryStringFor(config), CATEGORY_SEPARATOR);
@@ -443,7 +442,7 @@ public class CheatSheetRegistryReader extends RegistryReader implements IRegistr
* The return value for this method is cached since computing its value
* requires non-trivial work.
*/
- public AdaptableList getCheatSheets() {
+ public CheatSheetCollectionElement getCheatSheets() {
if (cheatsheets == null)
readCheatSheets();
return cheatsheets;

Back to the top