[jboss-cvs] jbosside/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/src/org/jboss/ide/eclipse/as/ui/mbeans/editors ...
Robert Stryker
rawblem at gmail.com
Thu Nov 30 12:53:30 EST 2006
User: rawb
Date: 06/11/30 12:53:30
Modified: as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/src/org/jboss/ide/eclipse/as/ui/mbeans/editors
ServiceXMLEditorConfiguration.java
Log:
Small fix to remove duplicate proposals in attributes
Revision Changes Path
1.2 +15 -2 jbosside/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/src/org/jboss/ide/eclipse/as/ui/mbeans/editors/ServiceXMLEditorConfiguration.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ServiceXMLEditorConfiguration.java
===================================================================
RCS file: /cvsroot/jboss/jbosside/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/src/org/jboss/ide/eclipse/as/ui/mbeans/editors/ServiceXMLEditorConfiguration.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- ServiceXMLEditorConfiguration.java 16 Nov 2006 22:45:30 -0000 1.1
+++ ServiceXMLEditorConfiguration.java 30 Nov 2006 17:53:30 -0000 1.2
@@ -368,6 +368,12 @@
protected void addTagInsertionProposals(ContentAssistRequest contentAssistRequest, int childPosition) {
super.addTagInsertionProposals(contentAssistRequest, childPosition);
+ List superProps = contentAssistRequest.getProposals();
+ ICompletionProposal[] proposals = (ICompletionProposal[]) superProps.toArray(new ICompletionProposal[superProps.size()]);
+ ArrayList alreadyAddedStrings = new ArrayList();
+ for( int i = 0; i < proposals.length; i++ ) {
+ alreadyAddedStrings.add(proposals[i].getDisplayString());
+ }
String parentElement = contentAssistRequest.getParent().getNodeName();
ArrayList possibleNodes = (ArrayList)children.get(parentElement);
@@ -454,6 +460,13 @@
protected void addAttributeNameProposals(ContentAssistRequest contentAssistRequest) {
super.addAttributeNameProposals(contentAssistRequest);
+ List superProps = contentAssistRequest.getProposals();
+ ICompletionProposal[] proposals = (ICompletionProposal[]) superProps.toArray(new ICompletionProposal[superProps.size()]);
+ ArrayList alreadyAddedStrings = new ArrayList();
+ for( int i = 0; i < proposals.length; i++ ) {
+ alreadyAddedStrings.add(proposals[i].getDisplayString());
+ }
+
Image attImage = XMLEditorPluginImageHelper.getInstance().getImage(XMLEditorPluginImages.IMG_OBJ_ATTRIBUTE);
@@ -470,7 +483,7 @@
Iterator i = list.iterator();
while(i.hasNext()) {
DTDAttributes att = (DTDAttributes)i.next();
- if( att.name.startsWith(match) && !activeAttributes.contains(att.name)) {
+ if( att.name.startsWith(match) && !activeAttributes.contains(att.name) && !alreadyAddedStrings.contains(att.name)) {
String txt = att.name + "=\"" + att.defaultValue + "\"";
contentAssistRequest.addProposal(new CompletionProposal(txt, contentAssistRequest.getReplacementBeginPosition(),
match.length(), txt.length()-1, attImage, att.name, null, null));
More information about the jboss-cvs-commits
mailing list