more doc
diff --git a/org.eclipse.wst.common.snippets/src/org/eclipse/wst/common/snippets/core/ISnippetCategory.java b/org.eclipse.wst.common.snippets/src/org/eclipse/wst/common/snippets/core/ISnippetCategory.java
index b5d9960..668d7a9 100644
--- a/org.eclipse.wst.common.snippets/src/org/eclipse/wst/common/snippets/core/ISnippetCategory.java
+++ b/org.eclipse.wst.common.snippets/src/org/eclipse/wst/common/snippets/core/ISnippetCategory.java
@@ -11,5 +11,8 @@
package org.eclipse.wst.common.snippets.core;
public interface ISnippetCategory extends ISnippetsEntry {
+ /**
+ * @return an array of the items within this category
+ */
ISnippetItem[] getItems();
}
\ No newline at end of file
diff --git a/org.eclipse.wst.common.snippets/src/org/eclipse/wst/common/snippets/core/ISnippetsEntry.java b/org.eclipse.wst.common.snippets/src/org/eclipse/wst/common/snippets/core/ISnippetsEntry.java
index 0681581..7e7448f 100644
--- a/org.eclipse.wst.common.snippets/src/org/eclipse/wst/common/snippets/core/ISnippetsEntry.java
+++ b/org.eclipse.wst.common.snippets/src/org/eclipse/wst/common/snippets/core/ISnippetsEntry.java
@@ -40,7 +40,11 @@
* @return a longer description to display for this item
*/
String getDescription();
-
+
+ /**
+ * @return the filters for which this entry will be shown (when filtering
+ * is enabled)
+ */
String[] getFilters();
/**
diff --git a/org.eclipse.wst.common.snippets/src/org/eclipse/wst/common/snippets/ui/DefaultSnippetInsertion.java b/org.eclipse.wst.common.snippets/src/org/eclipse/wst/common/snippets/ui/DefaultSnippetInsertion.java
index 10dc1f4..6fdc34a 100644
--- a/org.eclipse.wst.common.snippets/src/org/eclipse/wst/common/snippets/ui/DefaultSnippetInsertion.java
+++ b/org.eclipse.wst.common.snippets/src/org/eclipse/wst/common/snippets/ui/DefaultSnippetInsertion.java
@@ -42,7 +42,6 @@
* will be replaced with user-supplied values at insertion time.
*/
public class DefaultSnippetInsertion implements ISnippetInsertion {
- private IEditorPart fEditorPart;
private ISnippetItem fItem = null;
private Transfer[] fSupportedTransfers = null;
@@ -50,6 +49,9 @@
super();
}
+ /**
+ * @return an array of Transfer types supported by this insertion
+ */
protected Transfer[] createTransfers() {
return new Transfer[]{SnippetTextTransfer.getTransferInstance(), TextTransfer.getInstance()};
}
@@ -134,34 +136,34 @@
}
protected String getInsertString(Shell host) {
- if (getItem() == null)
+ if (fItem == null)
return ""; //$NON-NLS-1$
String insertString = null;
- ISnippetItem item = getItem();
- if (item.getVariables().length > 0) {
- insertString = VariableItemHelper.getInsertString(host, item);
+ if (fItem.getVariables().length > 0) {
+ insertString = VariableItemHelper.getInsertString(host, fItem);
}
else {
- insertString = StringUtils.replace(item.getContentString(), "${cursor}", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ insertString = StringUtils.replace(fItem.getContentString(), "${cursor}", ""); //$NON-NLS-1$ //$NON-NLS-2$
}
return insertString;
}
- /**
- * Gets the Item.
+ /*
+ * (non-Javadoc)
*
- * @return the ISnippetItem
+ * @see org.eclipse.wst.common.snippets.ui.ISnippetInsertion#getTransfers()
*/
- public final ISnippetItem getItem() {
- return fItem;
- }
-
public Transfer[] getTransfers() {
if (fSupportedTransfers == null)
fSupportedTransfers = createTransfers();
return fSupportedTransfers;
}
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.wst.common.snippets.ui.ISnippetInsertion#insert(org.eclipse.ui.IEditorPart)
+ */
public void insert(IEditorPart editorPart) {
if (editorPart == null)
return;
@@ -218,7 +220,7 @@
doInsert(editor, editor, document, textSel);
}
catch (Exception t) {
- Logger.logException("Could not insert " + getItem(), t); //$NON-NLS-1$
+ Logger.logException("Could not insert " + fItem, t); //$NON-NLS-1$
editor.getSite().getShell().getDisplay().beep();
}
}
@@ -227,21 +229,20 @@
}
- /**
- * Sets the fItem.
+ /*
+ * (non-Javadoc)
*
- * @param fItem
- * The ISnippetItem to use
+ * @see org.eclipse.wst.common.snippets.ui.ISnippetInsertion#setEditorPart(org.eclipse.ui.IEditorPart)
*/
- public final void setItem(ISnippetItem item) {
- fItem = item;
- }
-
- public IEditorPart getEditorPart() {
- return fEditorPart;
- }
-
public void setEditorPart(IEditorPart editorPart) {
- fEditorPart = editorPart;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.wst.common.snippets.ui.ISnippetInsertion#setItem(org.eclipse.wst.common.snippets.core.ISnippetItem)
+ */
+ public void setItem(ISnippetItem item) {
+ fItem = item;
}
}
\ No newline at end of file
diff --git a/org.eclipse.wst.common.snippets/src/org/eclipse/wst/common/snippets/ui/ISnippetInsertion.java b/org.eclipse.wst.common.snippets/src/org/eclipse/wst/common/snippets/ui/ISnippetInsertion.java
index 482178a..9bec111 100644
--- a/org.eclipse.wst.common.snippets/src/org/eclipse/wst/common/snippets/ui/ISnippetInsertion.java
+++ b/org.eclipse.wst.common.snippets/src/org/eclipse/wst/common/snippets/ui/ISnippetInsertion.java
@@ -66,6 +66,13 @@
*/
void insert(IEditorPart editorPart);
+ /**
+ * The target editorpart in the workbench window. May be used as a hint
+ * for determining which Transfer types to allow and what transfer data to
+ * set during Drag and Drop operations.
+ *
+ * @param targetPart
+ */
void setEditorPart(IEditorPart targetPart);
/**