ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xav...@apache.org
Subject svn commit: r679833 [1/3] - in /ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse: ./ META-INF/ src/java/org/apache/ivyde/common/ src/java/org/apache/ivyde/common/completion/ src/java/org/apache/ivyde/common/ivyfile/ src/java/org/apache/ivyde/common/model/ ...
Date Fri, 25 Jul 2008 15:26:56 GMT
Author: xavier
Date: Fri Jul 25 08:26:55 2008
New Revision: 679833

URL: http://svn.apache.org/viewvc?rev=679833&view=rev
Log:
REFACTOR: extract code completion feature to make it reusable in other contexts (like other IDE plugins)

Added:
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/completion/
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/completion/CodeCompletionProposal.java   (with props)
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/completion/IvyCodeCompletionProcessor.java   (with props)
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/ivyfile/
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/ivyfile/IvyModuleDescriptorFile.java   (with props)
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/ivyfile/IvyModuleDescriptorModel.java   (with props)
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/model/
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/model/IValueProvider.java   (contents, props changed)
      - copied, changed from r669878, ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/core/model/IValueProvider.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/model/IvyBooleanTagAttribute.java   (contents, props changed)
      - copied, changed from r669878, ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/core/model/IvyBooleanTagAttribute.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/model/IvyFile.java   (contents, props changed)
      - copied, changed from r669878, ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/core/model/IvyFile.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/model/IvyModel.java   (contents, props changed)
      - copied, changed from r669878, ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/core/model/IvyModel.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/model/IvyModelSettings.java   (with props)
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/model/IvyReferenceTag.java   (with props)
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/model/IvyTag.java   (contents, props changed)
      - copied, changed from r669878, ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/core/model/IvyTag.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/model/IvyTagAttribute.java   (contents, props changed)
      - copied, changed from r669878, ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/core/model/IvyTagAttribute.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/model/ListValueProvider.java   (contents, props changed)
      - copied, changed from r669878, ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/core/model/ListValueProvider.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/model/Proposal.java   (contents, props changed)
      - copied, changed from r669878, ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/core/model/Proposal.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/model/SingleValueProvider.java   (contents, props changed)
      - copied, changed from r669878, ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/core/model/SingleValueProvider.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/model/defaults.properties   (contents, props changed)
      - copied, changed from r669878, ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/core/model/defaults.properties
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/model/tagsdoc.properties   (with props)
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/IvyModuleDescriptorEditor.java   (contents, props changed)
      - copied, changed from r669878, ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/IvyEditor.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/IvyModuleDescriptorEditorContributor.java   (contents, props changed)
      - copied, changed from r669878, ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/IvyEditorContributor.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/EclipseIvyModelSettings.java   (with props)
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/test/java/org/apache/ivyde/common/
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/test/java/org/apache/ivyde/common/model/
      - copied from r669878, ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/test/java/org/apache/ivyde/eclipse/core/model/
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/test/java/org/apache/ivyde/common/model/IvyFileUtilTest.java
      - copied, changed from r679832, ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/test/java/org/apache/ivyde/eclipse/core/model/IvyFileUtilTest.java
Removed:
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/core/model/IValueProvider.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/core/model/IvyBooleanTagAttribute.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/core/model/IvyFile.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/core/model/IvyModel.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/core/model/IvyTag.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/core/model/IvyTagAttribute.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/core/model/ListValueProvider.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/core/model/PreferenceValueProvider.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/core/model/Proposal.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/core/model/SingleValueProvider.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/core/model/defaults.properties
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/IvyEditor.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/IvyEditorContributor.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/test/java/org/apache/ivyde/eclipse/core/model/
Modified:
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/META-INF/MANIFEST.MF
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/plugin.xml
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/IvyContentAssistProcessor.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLConfiguration.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLEditor.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/wizards/IvyNewWizard.java

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/META-INF/MANIFEST.MF?rev=679833&r1=679832&r2=679833&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/META-INF/MANIFEST.MF (original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/META-INF/MANIFEST.MF Fri Jul 25 08:26:55 2008
@@ -14,7 +14,6 @@
  org.apache.ivyde.eclipse.ui.actions,
  org.apache.ivyde.eclipse.ui.console,
  org.apache.ivyde.eclipse.ui.core,
- org.apache.ivyde.eclipse.ui.core.model,
  org.apache.ivyde.eclipse.ui.editors,
  org.apache.ivyde.eclipse.ui.editors.pages,
  org.apache.ivyde.eclipse.ui.editors.xml,

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/plugin.xml
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/plugin.xml?rev=679833&r1=679832&r2=679833&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/plugin.xml (original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/plugin.xml Fri Jul 25 08:26:55 2008
@@ -94,8 +94,8 @@
    <extension
          point="org.eclipse.ui.editors">
       <editor
-            class="org.apache.ivyde.eclipse.ui.editors.IvyEditor"
-            contributorClass="org.apache.ivyde.eclipse.ui.editors.IvyEditorContributor"
+            class="org.apache.ivyde.eclipse.ui.editors.IvyModuleDescriptorEditor"
+            contributorClass="org.apache.ivyde.eclipse.ui.editors.IvyModuleDescriptorEditorContributor"
             filenames="ivy.xml,ivy-dev.xml,ivy-snapshot.xml"
             icon="icons/logo16x16.gif"
             id="org.apache.ivyde.editors.IvyEditor"

Added: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/completion/CodeCompletionProposal.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/completion/CodeCompletionProposal.java?rev=679833&view=auto
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/completion/CodeCompletionProposal.java (added)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/completion/CodeCompletionProposal.java Fri Jul 25 08:26:55 2008
@@ -0,0 +1,78 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package org.apache.ivyde.common.completion;
+
+public class CodeCompletionProposal {
+
+    /** The string to be displayed in the completion proposal popup. */
+    private String displayString;
+
+    /** The replacement string. */
+    private String replacementString;
+
+    /** The replacement offset. */
+    private int replacementOffset;
+
+    /** The replacement length. */
+    private int replacementLength;
+
+    /** The cursor position after this proposal has been applied. */
+    private int cursorPosition;
+
+    /** The documentation of this proposal. */
+    private String doc;
+
+    public CodeCompletionProposal(String replacementString, int replacementOffset,
+            int replacementLength, int cursorPosition) {
+        this(replacementString, replacementOffset, replacementLength, cursorPosition, null, null);
+    }
+
+    public CodeCompletionProposal(String replacementString, int replacementOffset,
+            int replacementLength, int cursorPosition, String displayString, String doc) {
+        this.replacementString = replacementString;
+        this.replacementOffset = replacementOffset;
+        this.replacementLength = replacementLength;
+        this.cursorPosition = cursorPosition;
+        this.displayString = displayString;
+        this.doc = doc;
+    }
+
+    public String getDisplayString() {
+        return displayString;
+    }
+
+    public String getReplacementString() {
+        return replacementString;
+    }
+
+    public int getReplacementOffset() {
+        return replacementOffset;
+    }
+
+    public int getReplacementLength() {
+        return replacementLength;
+    }
+
+    public int getCursorPosition() {
+        return cursorPosition;
+    }
+
+    public String getDoc() {
+        return doc;
+    }
+}

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/completion/CodeCompletionProposal.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/completion/CodeCompletionProposal.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/completion/IvyCodeCompletionProcessor.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/completion/IvyCodeCompletionProcessor.java?rev=679833&view=auto
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/completion/IvyCodeCompletionProcessor.java (added)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/completion/IvyCodeCompletionProcessor.java Fri Jul 25 08:26:55 2008
@@ -0,0 +1,214 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package org.apache.ivyde.common.completion;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.ivyde.common.model.IvyFile;
+import org.apache.ivyde.common.model.IvyModel;
+import org.apache.ivyde.common.model.IvyTag;
+import org.apache.ivyde.common.model.IvyTagAttribute;
+import org.apache.ivyde.common.model.Proposal;
+
+public class IvyCodeCompletionProcessor {
+    private String errorMessage = null;
+    private final IvyModel model;
+    
+    public IvyCodeCompletionProcessor(IvyModel model) {
+        this.model = model;
+    }
+
+    /**
+     * Call by viewer to retrieve a list of ICompletionProposal
+     */
+    public CodeCompletionProposal[] computeCompletionProposals(IvyFile ivyfile, int caretOffset) {
+        model.refreshIfNeeded(ivyfile);
+        List propList = new ArrayList();
+        if (ivyfile.inTag()) {
+            String tagName = ivyfile.getTagName();
+            if (ivyfile.readyForValue()) {
+                computeValueProposals(tagName, ivyfile, propList, caretOffset);
+            } else {
+                // found a value to put in tag
+                computeTagAttributeProposals(tagName, ivyfile, propList, caretOffset);
+            }
+        } else { // not in an xml tag
+            computeStructureProposals(ivyfile, propList, caretOffset);
+        }
+
+        return (CodeCompletionProposal[]) propList.toArray(
+                            new CodeCompletionProposal[propList.size()]);
+    }
+
+    /**
+     * Compute a list of possible attribute for the tag given in arguement.<br/> If attribute are
+     * already used in tag they are discard of the list
+     * 
+     * @param tagName
+     * @param doc
+     * @param documentOffset
+     * @param propList
+     * @param selectedRange
+     */
+    private void computeTagAttributeProposals(String tagName, IvyFile ivyfile, List propList,
+            int caretOffset) {
+        String qualifier = ivyfile.getQualifier();
+        int qlen = qualifier.length();
+        if (qualifier.indexOf('/') > -1) {
+            String text = "/>";
+            CodeCompletionProposal proposal = new CodeCompletionProposal(
+                text, ivyfile.getOffset() - qlen, qlen + caretOffset, text.length());
+            propList.add(proposal);
+        } else {
+            String parent = ivyfile.getParentTagName();
+            IvyTag tag = model.getIvyTag(tagName, parent);
+            if (tag == null) {
+                errorMessage = "tag :" + tagName + " not found in model:";
+                return;
+            }
+            errorMessage = null;
+            List atts = tag.getAttributes();
+            Map existingAtts = ivyfile.getAllAttsValues();
+            // Loop through all proposals
+            for (Iterator iter = atts.iterator(); iter.hasNext();) {
+                IvyTagAttribute att = (IvyTagAttribute) iter.next();
+                if (att.getName().startsWith(qualifier) && !existingAtts.containsKey(att.getName())) {
+                    // Yes -- compute whole proposal text
+                    String text = att.getName() + "=\"\"";
+                    // Construct proposal
+                    CodeCompletionProposal proposal = new CodeCompletionProposal(
+                            text, ivyfile.getOffset() - qlen, qlen + caretOffset, 
+                            text.length() - 1, att.getName(), att.getDoc());
+                    // and add to result list
+                    propList.add(proposal);
+                }
+            }
+        }
+    }
+
+    /**
+     * Compute a list of possible values for the current attribute of the given tag.<br>
+     * The list is retrieve by calling <code> IvyTag.getPossibleValuesForAttribute</code>
+     * 
+     * @see IvyTag#getPossibleValuesForAttribute(String, Map, String)
+     * @param tagName
+     * @param doc
+     * @param documentOffset
+     * @param propList
+     * @param selection
+     */
+    private void computeValueProposals(String tagName, IvyFile ivyfile, List propList,
+            int caretOffset) {
+        String parent = null;
+        String tag = ivyfile.getTagName();
+        if (tag != null) {
+            parent = ivyfile.getParentTagName(ivyfile.getStringIndexBackward("<" + tag));
+        }
+        IvyTag ivyTag = model.getIvyTag(tag, parent);
+        if (ivyTag != null) {
+            String[] values = ivyTag.getPossibleValuesForAttribute(ivyfile.getAttributeName(),
+                ivyfile);
+            if (values != null) {
+                String qualifier = ivyfile.getAttributeValueQualifier();
+                int qlen = qualifier == null ? 0 : qualifier.length();
+                Arrays.sort(values);
+                for (int i = 0; i < values.length; i++) {
+                    String val = values[i];
+                    CodeCompletionProposal proposal = new CodeCompletionProposal(
+                        val, ivyfile.getOffset() - qlen, qlen + caretOffset, val.length());
+                    propList.add(proposal);
+                }
+            }
+        }
+    }
+
+    /**
+     * Compute xml structural proposition
+     */
+    private void computeStructureProposals(IvyFile ivyfile, List propList, int caretOffset) {
+        String parent = ivyfile.getParentTagName();
+        String qualifier = ivyfile.getQualifier();
+        int qlen = qualifier.length();
+        if (parent != null
+                && ivyfile.getOffset() >= 2 + qualifier.length()
+                && ivyfile.getString(ivyfile.getOffset() - 2 - qualifier.length(),
+                    ivyfile.getOffset()).startsWith("</")) {
+            // closing tag (already started)
+            String text = "</" + parent + ">";
+            CodeCompletionProposal proposal = new CodeCompletionProposal(
+                text, ivyfile.getOffset() - qlen - 2, qlen + 2 + caretOffset, text.length());
+            propList.add(proposal);
+        } else {
+            if (parent != null && qualifier.length() == 0) {
+                String text = "</" + parent + ">";
+                int closingIndex = ivyfile.getStringIndexForward(text);
+                int openingIndex = ivyfile.getStringIndexForward("<" + parent);
+                if (closingIndex == -1 || (openingIndex != -1 && closingIndex > openingIndex)) {
+                    // suggest closing tag if tag not yet closed
+                    CodeCompletionProposal proposal = new CodeCompletionProposal(
+                        text, ivyfile.getOffset(), caretOffset, text.length());
+                    propList.add(proposal);
+                }
+            }
+
+            List childs = null;
+
+            if (parent != null) {
+                String parentParent = ivyfile.getParentTagName(ivyfile.getStringIndexBackward("<"
+                        + parent));
+                IvyTag root = model.getIvyTag(parent, parentParent);
+                if (root == null) {
+                    errorMessage = "parent tag :" + parent + " not found in model:";
+                    return;
+                } else {
+                    childs = root.getChilds();
+                }
+            } else {
+                childs = Collections.singletonList(model.getRootIvyTag());
+            }
+            errorMessage = null;
+            for (Iterator iter = childs.iterator(); iter.hasNext();) {
+                IvyTag child = (IvyTag) iter.next();
+
+                // Check if proposal matches qualifier
+                if (child.getStartTag().startsWith(qualifier)) {
+                    Proposal[] props = child.getProposals();
+                    for (int i = 0; i < props.length; i++) {
+                        // Construct proposal and add to result list
+                        propList.add(new CodeCompletionProposal(
+                            props[i].getProposal(), ivyfile.getOffset()- qlen, qlen + caretOffset, 
+                            props[i].getCursor(), null, props[i].getDoc()));
+                    }
+                }
+            }
+        }
+    }
+
+    public String getErrorMessage() {
+        return errorMessage;
+    }
+
+    public IvyModel getModel() {
+        return model;
+    }
+}

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/completion/IvyCodeCompletionProcessor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/completion/IvyCodeCompletionProcessor.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/ivyfile/IvyModuleDescriptorFile.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/ivyfile/IvyModuleDescriptorFile.java?rev=679833&view=auto
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/ivyfile/IvyModuleDescriptorFile.java (added)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/ivyfile/IvyModuleDescriptorFile.java Fri Jul 25 08:26:55 2008
@@ -0,0 +1,88 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package org.apache.ivyde.common.ivyfile;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.ivyde.common.model.IvyFile;
+import org.apache.ivyde.common.model.IvyModelSettings;
+
+public class IvyModuleDescriptorFile extends IvyFile {
+    private static final Pattern CONF_PATTERN = Pattern.compile("<[\\s]*conf[^>]+name=\"([^\"]+)");
+
+    private static final Pattern CONFIGURATIONS_END_PATTERN = Pattern
+            .compile("</[\\s]*configurations[\\s]*>");
+
+    private static final Pattern CONFIGURATIONS_START_PATTERN = Pattern
+            .compile("<[\\s]*configurations[\\s]*>");
+
+    public IvyModuleDescriptorFile(IvyModelSettings settings, String projectName, String doc) {
+        this(settings, projectName, doc, 0);
+    }
+
+    public IvyModuleDescriptorFile(IvyModelSettings settings, String projectName, String doc, int currentOffset) {
+        super(settings, projectName, doc, currentOffset);
+    }
+
+    public String[] getConfigurationNames() {
+        Pattern p = CONFIGURATIONS_START_PATTERN;
+        Matcher m = p.matcher(getDoc());
+        if (m.find()) {
+            int start = m.end();
+            p = CONFIGURATIONS_END_PATTERN;
+            m = p.matcher(getDoc());
+            int end = getDoc().length();
+            if (m.find(start)) {
+                end = m.start();
+            }
+            p = CONF_PATTERN;
+            m = p.matcher(getDoc());
+            List ret = new ArrayList();
+            for (boolean found = m.find(start); found && m.end() < end; found = m.find()) {
+                ret.add(m.group(1));
+            }
+            return (String[]) ret.toArray(new String[ret.size()]);
+        } else {
+            return new String[] {"default"};
+        }
+    }
+
+    public String getOrganisation() {
+        Pattern p = Pattern.compile("<[\\s]*info[^>]*organisation[\\s]*=[\\s]*\"([^\"]+)");
+        Matcher m = p.matcher(getDoc());
+        if (m.find()) {
+            return m.group(1);
+        }
+        return null;
+    }
+
+    public String getDependencyOrganisation() {
+        Map otherAttValues = getAllAttsValues();
+        return getDependencyOrganisation(otherAttValues);
+    }
+
+    public String getDependencyOrganisation(Map otherAttValues) {
+        return otherAttValues != null && otherAttValues.get("org") != null ? (String) otherAttValues
+                .get("org")
+                : getOrganisation();
+    }
+}

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/ivyfile/IvyModuleDescriptorFile.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/ivyfile/IvyModuleDescriptorFile.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/ivyfile/IvyModuleDescriptorModel.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/ivyfile/IvyModuleDescriptorModel.java?rev=679833&view=auto
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/ivyfile/IvyModuleDescriptorModel.java (added)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/ivyfile/IvyModuleDescriptorModel.java Fri Jul 25 08:26:55 2008
@@ -0,0 +1,759 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package org.apache.ivyde.common.ivyfile;
+
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.ivy.Ivy;
+import org.apache.ivy.core.IvyPatternHelper;
+import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor;
+import org.apache.ivy.core.module.id.ModuleRevisionId;
+import org.apache.ivy.core.resolve.ResolveData;
+import org.apache.ivy.core.resolve.ResolveOptions;
+import org.apache.ivy.core.resolve.ResolvedModuleRevision;
+import org.apache.ivy.plugins.resolver.DependencyResolver;
+import org.apache.ivyde.common.model.IValueProvider;
+import org.apache.ivyde.common.model.IvyBooleanTagAttribute;
+import org.apache.ivyde.common.model.IvyFile;
+import org.apache.ivyde.common.model.IvyModel;
+import org.apache.ivyde.common.model.IvyModelSettings;
+import org.apache.ivyde.common.model.IvyTag;
+import org.apache.ivyde.common.model.IvyTagAttribute;
+import org.apache.ivyde.common.model.ListValueProvider;
+
+public class IvyModuleDescriptorModel extends IvyModel {
+    public IvyModuleDescriptorModel(IvyModelSettings settings) {
+        super(settings);
+        
+        // ivy-module
+        IvyTag ivyTag = new IvyTag("ivy-module", "root tag of ivy file");
+        ivyTag.setDoc("Root tag of any ivy-file.");
+        ivyTag.addAttribute(new IvyTagAttribute(
+                        "version",
+                        "The version of the ivy file specification \n"
+                        + "should be '2.0' with current version of ivy",
+                        true));
+        addTag(ivyTag);
+
+        IValueProvider defaultOrganizationProvider = new IValueProvider() {
+            public String[] getValuesfor(IvyTagAttribute att, IvyFile ivyFile) {
+                return new String[] {getSettings().getDefaultOrganization()};
+            }
+        };
+        IValueProvider defaultOrganizationURLProvider = new IValueProvider() {
+            public String[] getValuesfor(IvyTagAttribute att, IvyFile ivyFile) {
+                return new String[] {getSettings().getDefaultOrganizationURL()};
+            }
+        };
+
+        // info
+        IvyTagAttribute orgTagAttribute = new IvyTagAttribute("organisation",
+                "the name of the organisation that is the owner of this module.", true);
+        orgTagAttribute.setValueProvider(defaultOrganizationProvider);
+        IvyTagAttribute statusTagAttribute = new IvyTagAttribute("status",
+                "the status of this module.");
+        statusTagAttribute.setValueProvider(new ListValueProvider(getDefault("status")));
+        IvyTagAttribute pubTagAttribute = new IvyTagAttribute("publication",
+                "the date of publication of this module. \nIt should be given in this format: yyyyMMddHHmmss");
+        pubTagAttribute.setValueProvider(new IValueProvider() {
+            public String[] getValuesfor(IvyTagAttribute att, IvyFile ivyFile) {
+                return new String[] {Ivy.DATE_FORMAT.format(new Date())};
+            }
+        });
+        IvyTagAttribute moduleTagAttribute = new IvyTagAttribute("module",
+                "the name of the module described by this ivy file.", true);
+        IValueProvider projectNameValueProvider = new IValueProvider() {
+            public String[] getValuesfor(IvyTagAttribute att, IvyFile ivyFile) {
+                return new String[] {ivyFile.getProjectName()};
+            }
+        };
+        moduleTagAttribute.setValueProvider(projectNameValueProvider);
+        IvyTag info = new IvyTag("info", "gives general information about the described module",
+                new IvyTagAttribute[] {orgTagAttribute, moduleTagAttribute,
+                        new IvyTagAttribute("branch", "the branch of this module."),
+                        new IvyTagAttribute("revision", "the revision of this module."),
+                        statusTagAttribute, pubTagAttribute});
+        addTag(info);
+        IvyTag child = new IvyTag("license",
+                "gives information about the licenses of the described module");
+        child
+                .addAttribute(new IvyTagAttribute(
+                        "name",
+                        "the name of the license. \nTry to respect spelling when using a classical license.",
+                        true, new ListValueProvider(getDefault("license"))));
+        child
+                .addAttribute(new IvyTagAttribute("url", "an url pointing to the license text.",
+                        false));
+        addTag(child);
+        info.addChildIvyTag(child);
+        child = new IvyTag("ivyauthor", "describes who has contributed to write the ivy file");
+        child.addAttribute(new IvyTagAttribute("name",
+                "the name of the author, as a person or a company.", true,
+                defaultOrganizationProvider));
+        child.addAttribute(new IvyTagAttribute("url",
+                "an url pointing to where the author can be reached.", false,
+                defaultOrganizationURLProvider));
+        addTag(child);
+        info.addChildIvyTag(child);
+        child = new IvyTag("repository",
+                "describes on which public repositories this module can be found");
+        child
+                .addAttribute(new IvyTagAttribute(
+                        "name",
+                        "the name of the repository. \nTry to respect spelling for common repositories (ibiblio, ivyrep, ...)",
+                        true, new IValueProvider() {
+                            public String[] getValuesfor(IvyTagAttribute att, IvyFile ivyFile) {
+                                return new String[] {"ibiblio", "ivyrep"};
+                            }
+                        }));
+        child.addAttribute(new IvyTagAttribute("url", "an url pointing to the repository.", true,
+                new IValueProvider() {
+                    public String[] getValuesfor(IvyTagAttribute att, IvyFile ivyFile) {
+                        Map allAttsValues = ivyFile.getAllAttsValues();
+                        if (allAttsValues != null) {
+                            String name = (String) allAttsValues.get("name");
+                            if ("ibiblio".equals(name)) {
+                                return new String[] {"http://www.ibiblio.org/maven/"};
+                            } else if ("ivyrep".equals(name)) {
+                                return new String[] {"http://www.jayasoft.fr/org/ivyrep/"};
+                            }
+                        }
+                        return null;
+                    }
+
+                }));
+        IvyTagAttribute reppatternTagAttribute = new IvyTagAttribute("pattern",
+                "an ivy pattern to find modules on this repository", false);
+        reppatternTagAttribute.setValueProvider(new IValueProvider() {
+            public String[] getValuesfor(IvyTagAttribute att, IvyFile ivyFile) {
+                Map allAttsValues = ivyFile.getAllAttsValues();
+                if (allAttsValues != null) {
+                    String name = (String) allAttsValues.get("name");
+                    if ("ibiblio".equals(name)) {
+                        return new String[] {"[module]/[type]s/[artifact]-[revision].[ext]"};
+                    } else if ("ivyrep".equals(name)) {
+                        return new String[] {"[organisation]/[module]/[artifact]-[revision].[ext]"};
+                    }
+                }
+                return null;
+            }
+        });
+        child.addAttribute(reppatternTagAttribute);
+        child.addAttribute(new IvyBooleanTagAttribute("ivys",
+                "true if ivy file can be found on this repository", false));
+        child.addAttribute(new IvyBooleanTagAttribute("artifacts",
+                "true if module artifacts can be found on this repository", false));
+        addTag(child);
+        info.addChildIvyTag(child);
+        child = new IvyTag("description", "gives general description about the module");
+        child.addAttribute(new IvyTagAttribute("homepage", "the url of the homepage of the module",
+                false, defaultOrganizationURLProvider));
+        addTag(child);
+        info.addChildIvyTag(child);
+        ivyTag.addChildIvyTag(info);
+
+        // configurations
+        IvyTag configurations = new IvyTag("configurations", "container for configuration elements");
+        IvyTag conf = new IvyTag("conf", "declares a configuration of this module");
+        conf.addAttribute(new IvyTagAttribute("name", "the name of the declared configuration",
+                true));
+        conf.addAttribute(new IvyTagAttribute("description",
+                "a short description for the declared configuration", false));
+        IvyTagAttribute visibilityTagAttribute = new IvyTagAttribute(
+                "visibility",
+                "the visibility of the declared configuration.\n'public' means that this configuration can be used by other modules, \nwhile 'private' means that this configuration is used only in the module itself, \nand is not exposed to other modules",
+                false);
+        visibilityTagAttribute.setValueProvider(new IValueProvider() {
+            public String[] getValuesfor(IvyTagAttribute att, IvyFile ivyFile) {
+                return new String[] {"public", "private"};
+            }
+        });
+        conf.addAttribute(visibilityTagAttribute);
+        IvyTagAttribute confExtTagAttribute = new IvyTagAttribute(
+                "extends",
+                "a comma separated list of configurations of this module \nthat the current configuration extends",
+                false);
+        IValueProvider masterConfsValueProvider = new IValueProvider() {
+            public String[] getValuesfor(IvyTagAttribute att, IvyFile ivyFile) {
+                StringBuffer base = new StringBuffer();
+                String qualifier = ivyFile.getAttributeValueQualifier();
+                int comma = qualifier.lastIndexOf(",") + 1;
+                base.append(qualifier.substring(0, comma));
+                qualifier = qualifier.substring(comma);
+                while (qualifier.length() > 0 && qualifier.charAt(0) == ' ') {
+                    base.append(' ');
+                    qualifier = qualifier.substring(1);
+                }
+                String[] confs = ((IvyModuleDescriptorFile) ivyFile).getConfigurationNames();
+                for (int i = 0; i < confs.length; i++) {
+                    confs[i] = base + confs[i];
+                }
+                return confs;
+            }
+        };
+        IValueProvider masterConfValueProvider = new IValueProvider() {
+            public String[] getValuesfor(IvyTagAttribute att, IvyFile ivyFile) {
+                return ((IvyModuleDescriptorFile) ivyFile).getConfigurationNames();
+            }
+        };
+        confExtTagAttribute.setValueProvider(masterConfsValueProvider);
+        conf.addAttribute(confExtTagAttribute);
+        IvyTagAttribute deprecatedTagAttribute = new IvyTagAttribute(
+                "deprecated",
+                "indicates that this conf has been deprecated \nby giving the date of the deprecation. \nIt should be given in this format: yyyyMMddHHmmss",
+                false);
+        deprecatedTagAttribute.setValueProvider(new IValueProvider() {
+            public String[] getValuesfor(IvyTagAttribute att, IvyFile ivyFile) {
+                return new String[] {Ivy.DATE_FORMAT.format(new Date())};
+            }
+        });
+        conf.addAttribute(deprecatedTagAttribute);
+        configurations.addChildIvyTag(conf);
+        List allConf = new ArrayList();
+        allConf.add(conf);
+        addTag(conf.getName(), allConf);
+        ivyTag.addChildIvyTag(configurations);
+        addTag(configurations);
+
+        // configurations
+        IvyTag publications = new IvyTag("publications",
+                "container for published artifact elements");
+        IvyTag artifact = new IvyTag("artifact", "declares a published artifact for this module");
+        artifact.addAttribute(new IvyTagAttribute("name",
+                "the name of the published artifact. This name must not include revision.", true,
+                projectNameValueProvider));
+        artifact
+                .addAttribute(new IvyTagAttribute(
+                        "type",
+                        "the type of the published artifact. \nIt's usually its extension, but not necessarily. \nFor instance, ivy files are of type 'ivy' but have 'xml' extension",
+                        true, new ListValueProvider(getDefault("type"))));
+        artifact.addAttribute(new IvyTagAttribute("ext", "the extension of the published artifact",
+                false, new ListValueProvider(getDefault("ext"))));
+        artifact
+                .addAttribute(new IvyTagAttribute(
+                        "conf",
+                        "comma separated list of public configurations in which this artifact is published. \n'*' wildcard can be used to designate all public configurations of this module",
+                        false, masterConfsValueProvider));
+        IvyTag conf2 = new IvyTag("conf",
+                "indicates a public configuration in which this artifact is published");
+        conf2
+                .addAttribute(new IvyTagAttribute(
+                        "name",
+                        "the name of a module public configuration in which this artifact is published. \n'*' wildcard can be used to designate all public configurations of this module",
+                        true, masterConfValueProvider));
+        allConf.add(conf2);
+        artifact.addChildIvyTag(conf2);
+        publications.addChildIvyTag(artifact);
+        addTag(publications);
+        addTag(artifact);
+        ivyTag.addChildIvyTag(publications);
+
+        // dependencies
+        IvyTag dependencies = new IvyTag("dependencies", "container for dependency elements");
+        // dependency
+        IvyTag dependency = new IvyTag("dependency", "declares a dependency for this module") {
+            public String[] getPossibleValuesForAttribute(String att, IvyFile ivyfile) {
+                String[] r = super.getPossibleValuesForAttribute(att, ivyfile);
+                if (r == null) { // listing can be used even for extra attributes
+                    List ret = listDependencyTokenValues(att, ivyfile);
+                    return (String[]) ret.toArray(new String[ret.size()]);
+                } else {
+                    return r;
+                }
+            }
+        };
+        IvyTagAttribute orgAtt = new IvyTagAttribute("org",
+                "the name of the organisation of the dependency.", false);
+        orgAtt.setValueProvider(new IValueProvider() {
+            public String[] getValuesfor(IvyTagAttribute att, IvyFile ivyFile) {
+                List ret = listDependencyTokenValues(att.getName(), ivyFile);
+                ret.add(getSettings().getDefaultOrganization());
+                String org = ((IvyModuleDescriptorFile) ivyFile).getOrganisation();
+                if (org != null) {
+                    ret.add(org);
+                }
+                return (String[]) ret.toArray(new String[ret.size()]);
+            }
+
+        });
+        dependency.addAttribute(orgAtt);
+        IvyTagAttribute module = new IvyTagAttribute("name", "the module name of the dependency",
+                true);
+        module.setValueProvider(new IValueProvider() {
+            public String[] getValuesfor(IvyTagAttribute att, IvyFile ivyFile) {
+                List ret = listDependencyTokenValues(att.getName(), ivyFile);
+                return (String[]) ret.toArray(new String[ret.size()]);
+            }
+        });
+        dependency.addAttribute(module);
+        IvyTagAttribute branch = new IvyTagAttribute("branch",
+                "the branch of the dependency. \nDo not set if not needed.", false);
+        branch.setValueProvider(new IValueProvider() {
+            public String[] getValuesfor(IvyTagAttribute att, IvyFile ivyFile) {
+                List ret = listDependencyTokenValues(att.getName(), ivyFile);
+                return (String[]) ret.toArray(new String[ret.size()]);
+            }
+        });
+        dependency.addAttribute(branch);
+        IvyTagAttribute rev = new IvyTagAttribute(
+                "rev",
+                "the revision of the dependency. \nUse 'latest.integration' to get the latest version of the dependency. \nYou can also end the revision asked with a '+' to get the latest matching revision.",
+                true);
+        rev.setValueProvider(new IValueProvider() {
+            public String[] getValuesfor(IvyTagAttribute att, IvyFile ivyFile) {
+                List ret = listDependencyTokenValues(att.getName(), ivyFile);
+                ret.add("latest.integration");
+                return (String[]) ret.toArray(new String[ret.size()]);
+            }
+        });
+        dependency.addAttribute(rev);
+        dependency
+                .addAttribute(new IvyBooleanTagAttribute(
+                        "force",
+                        "a boolean to give an indication to conflict manager \nthat this dependency should be forced to this revision",
+                        false));
+        dependency.addAttribute(new IvyBooleanTagAttribute("transitive",
+                "a boolean indicating if this dependency should be resolved transitively or not",
+                false));
+        IvyTagAttribute confAtt = new IvyTagAttribute("conf",
+                "an inline mapping configuration spec", false);
+        dependency.addAttribute(confAtt);
+        confAtt.setValueProvider(new IValueProvider() {
+            public String[] getValuesfor(IvyTagAttribute att, IvyFile ivyFile) {
+                String qualifier = ivyFile.getAttributeValueQualifier();
+                int index = qualifier.lastIndexOf(';') + 1;
+                StringBuffer base = new StringBuffer(qualifier.substring(0, index));
+                qualifier = qualifier.substring(index);
+                int arrowIndex = qualifier.indexOf("->");
+                if (arrowIndex > -1) {
+                    // we are looking for a dep conf
+                    String org = ((IvyModuleDescriptorFile) ivyFile).getDependencyOrganisation();
+                    Map otherAttValues = ivyFile.getAllAttsValues();
+                    if (org != null && otherAttValues != null && otherAttValues.get("name") != null
+                            && otherAttValues.get("rev") != null) {
+                        otherAttValues.remove("org");
+                        String branch = (String) otherAttValues.remove("branch");
+                        otherAttValues.remove("conf");
+                        otherAttValues.remove("force");
+                        otherAttValues.remove("transitive");
+                        otherAttValues.remove("changing");
+                        return getDependencyConfs(org, (String) otherAttValues.remove("name"),
+                            branch, (String) otherAttValues.remove("rev"), otherAttValues,
+                            qualifier, base, arrowIndex);
+                    }
+
+                } else {
+                    // we are looking for a master conf
+                    return getMasterConfs(ivyFile, qualifier, base, arrowIndex);
+                }
+
+                return null;
+            }
+
+            private String[] getMasterConfs(IvyFile ivyFile, String qualifier, StringBuffer base,
+                    int arrowIndex) {
+                // search for word after last comma
+                int comma = qualifier.lastIndexOf(",") + 1;
+                base.append(qualifier.substring(0, comma));
+                qualifier = qualifier.substring(comma);
+                while (qualifier.length() > 0 && qualifier.charAt(0) == ' ') {
+                    base.append(' ');
+                    qualifier = qualifier.substring(1);
+                }
+                String[] confs = ((IvyModuleDescriptorFile) ivyFile).getConfigurationNames();
+                for (int i = 0; i < confs.length; i++) {
+                    confs[i] = base + confs[i];
+                }
+                List ret = new ArrayList(Arrays.asList(confs));
+                ret.add("*");
+                return (String[]) ret.toArray(new String[ret.size()]);
+            }
+
+            private String[] getDependencyConfs(String org, String name, String branch, String rev,
+                    Map otherAtts, String qualifier, StringBuffer base, int arrowIndex) {
+                Ivy ivy = getIvy();
+                if (ivy == null) {
+                    return null;
+                }
+                base.append(qualifier.substring(0, arrowIndex + 2));
+                qualifier = qualifier.substring(arrowIndex + 2);
+                // search for word after last comma
+                int comma = qualifier.lastIndexOf(",") + 1;
+                base.append(qualifier.substring(0, comma));
+                qualifier = qualifier.substring(comma);
+                while (qualifier.length() > 0 && qualifier.charAt(0) == ' ') {
+                    base.append(' ');
+                    qualifier = qualifier.substring(1);
+                }
+                ResolveData data = new ResolveData(ivy.getResolveEngine(), new ResolveOptions());
+                ModuleRevisionId mrid = ModuleRevisionId.newInstance(org, name, branch, rev,
+                    otherAtts);
+                DefaultDependencyDescriptor ddd = new DefaultDependencyDescriptor(mrid, false);
+                try {
+                    DependencyResolver resolver = ivy.getSettings().getResolver(mrid);
+                    if (resolver == null) {
+                        return null;
+                    }
+                    ResolvedModuleRevision dep = resolver.getDependency(ddd, data);
+                    if (dep == null) {
+                        return null;
+                    }
+                    String[] confs = dep.getDescriptor().getConfigurationsNames();
+                    for (int i = 0; i < confs.length; i++) {
+                        confs[i] = base + confs[i];
+                    }
+                    List ret = new ArrayList(Arrays.asList(confs));
+                    ret.add("*");
+                    return (String[]) ret.toArray(new String[ret.size()]);
+                } catch (ParseException e) {
+                    getSettings().logError("The dependencies of " + mrid
+                            + " could not be parsed", e);
+                    return null;
+                }
+            }
+
+        });
+        IvyTag conf3 = new IvyTag("conf", "defines configuration mapping has sub element");
+        conf3
+                .addAttribute(new IvyTagAttribute(
+                        "name",
+                        "the name of the master configuration to map. \n'*' wildcard can be used to designate all configurations of this module",
+                        true, masterConfValueProvider));
+        conf3
+                .addAttribute(new IvyTagAttribute(
+                        "mapped",
+                        "a comma separated list of dependency configurations \nto which this master configuration should be mapped",
+                        false, new IValueProvider() {
+                            public String[] getValuesfor(IvyTagAttribute att, IvyFile ivyFile) {
+                                Ivy ivy = getIvy();
+                                int[] indexes = ivyFile.getParentTagIndex();
+                                if (indexes != null && ivy != null) {
+                                    Map otherAttValues = ivyFile.getAllAttsValues(indexes[0] + 1);
+                                    String org = ((IvyModuleDescriptorFile) ivyFile)
+                                                    .getDependencyOrganisation(otherAttValues);
+                                    if (org != null && otherAttValues != null
+                                            && otherAttValues.get("name") != null
+                                            && otherAttValues.get("rev") != null) {
+                                        StringBuffer base = new StringBuffer();
+                                        String qualifier = ivyFile.getAttributeValueQualifier();
+                                        // search for word after last comma
+                                        int comma = qualifier.lastIndexOf(",") + 1;
+                                        base.append(qualifier.substring(0, comma));
+                                        qualifier = qualifier.substring(comma);
+                                        while (qualifier.length() > 0 && qualifier.charAt(0) == ' ') {
+                                            base.append(' ');
+                                            qualifier = qualifier.substring(1);
+                                        }
+                                        ResolveData data = new ResolveData(ivy.getResolveEngine(),
+                                                new ResolveOptions());
+                                        ModuleRevisionId mrid = ModuleRevisionId.newInstance(org,
+                                            (String) otherAttValues.get("name"),
+                                            (String) otherAttValues.get("rev"));
+                                        DefaultDependencyDescriptor ddd = new DefaultDependencyDescriptor(
+                                                mrid, false);
+                                        try {
+                                            String[] confs = ivy.getSettings().getResolver(mrid)
+                                                    .getDependency(ddd, data).getDescriptor()
+                                                    .getConfigurationsNames();
+                                            for (int i = 0; i < confs.length; i++) {
+                                                confs[i] = base + confs[i];
+                                            }
+                                            List ret = new ArrayList(Arrays.asList(confs));
+                                            ret.add("*");
+                                            return (String[]) ret.toArray(new String[ret.size()]);
+                                        } catch (ParseException e) {
+                                            getSettings().logError("The dependencies of "
+                                                    + mrid + " could not be parsed", e);
+                                            return new String[] {"*"};
+                                        }
+                                    }
+                                }
+                                return new String[] {"*"};
+                            }
+
+                        }));
+        allConf.add(conf3);
+        IvyTag mapped = new IvyTag("mapped",
+                "map dependency configurations for this master configuration");
+        mapped
+                .addAttribute(new IvyTagAttribute(
+                        "name",
+                        "the name of the dependency configuration mapped. \n'*' wildcard can be used to designate all configurations of this module",
+                        true, new IValueProvider() {
+                            public String[] getValuesfor(IvyTagAttribute att, IvyFile ivyFile) {
+                                Ivy ivy = getIvy();
+                                int[] indexes = ivyFile.getParentTagIndex();
+                                if (indexes != null && ivy != null) {
+                                    indexes = ivyFile.getParentTagIndex(indexes[0]);
+                                    if (indexes != null) {
+                                        Map otherAttValues = ivyFile
+                                                .getAllAttsValues(indexes[0] + 1);
+                                        String org = ((IvyModuleDescriptorFile) ivyFile)
+                                                .getDependencyOrganisation(otherAttValues);
+                                        if (org != null && otherAttValues != null
+                                                && otherAttValues.get("name") != null
+                                                && otherAttValues.get("rev") != null) {
+                                            ResolveData data = new ResolveData(ivy
+                                                    .getResolveEngine(), new ResolveOptions());
+                                            ModuleRevisionId mrid = ModuleRevisionId.newInstance(
+                                                org, (String) otherAttValues.get("name"),
+                                                (String) otherAttValues.get("rev"));
+                                            DefaultDependencyDescriptor ddd = new DefaultDependencyDescriptor(
+                                                    mrid, false);
+                                            try {
+                                                String[] confs = ivy.getSettings()
+                                                        .getResolver(mrid).getDependency(ddd, data)
+                                                        .getDescriptor().getConfigurationsNames();
+                                                List ret = new ArrayList(Arrays.asList(confs));
+                                                ret.add("*");
+                                                return (String[]) ret
+                                                        .toArray(new String[ret.size()]);
+                                            } catch (ParseException e) {
+                                                getSettings().logError(
+                                                    "The dependencies of "
+                                                        + mrid + " could not be parsed", e);
+                                                return new String[] {"*"};
+                                            }
+                                        }
+                                    }
+                                }
+                                return new String[] {"*"};
+                            }
+
+                        }));
+        conf3.addChildIvyTag(mapped);
+        addTag(mapped);
+
+        String[] matcherNames = new String[0];
+        Ivy ivy = getIvy();
+        if (ivy != null) {
+            matcherNames = (String[]) ivy.getSettings().getMatcherNames().toArray(new String[0]);
+        }
+        ListValueProvider matcherNamesProvider = new ListValueProvider(matcherNames);
+
+        IvyTag artifact2 = new IvyTag("artifact",
+                "defines artifacts restriction \nuse only if you do not control dependency ivy file");
+        artifact2
+                .addAttribute(new IvyTagAttribute(
+                        "name",
+                        "the name of an artifact of the \ndependency module to add to the include list, \nor a regexp matching this name",
+                        false));
+        artifact2
+                .addAttribute(new IvyTagAttribute(
+                        "type",
+                        "the type of the artifact of the \ndependency module to add to the include list, \nor a regexp matching this name",
+                        false, new ListValueProvider(getDefault("type"))));
+        artifact2
+                .addAttribute(new IvyTagAttribute(
+                        "ext",
+                        "the extension of the artifact of the \ndependency module to add to the include list, \nor a regexp matching this name",
+                        false, new ListValueProvider(getDefault("ext"))));
+        artifact2
+                .addAttribute(new IvyTagAttribute(
+                        "url",
+                        "an url where this artifact can be found \nif it isn't present at the standard \nlocation in the repository",
+                        false));
+        artifact2
+                .addAttribute(new IvyTagAttribute(
+                        "conf",
+                        "comma separated list of the master configurations \nin which this artifact should be included. \n'*' wildcard can be used to designate all configurations of this module",
+                        false, masterConfsValueProvider));
+        IvyTag conf4 = new IvyTag("conf", "configuration in which the artifact should be included");
+        conf4
+                .addAttribute(new IvyTagAttribute(
+                        "name",
+                        "the name of the master configuration in which \nthe enclosing artifact should be included",
+                        true, masterConfValueProvider));
+        allConf.add(conf4);
+        artifact2.addChildIvyTag(conf4);
+        addTag(artifact2);
+        IvyTag include = new IvyTag("include",
+                "defines artifacts restriction \nuse only if you do not control dependency ivy file");
+        include
+                .addAttribute(new IvyTagAttribute(
+                        "name",
+                        "the name of an artifact of the \ndependency module to add to the include list, \nor a regexp matching this name",
+                        false));
+        include
+                .addAttribute(new IvyTagAttribute(
+                        "type",
+                        "the type of the artifact of the \ndependency module to add to the include list, \nor a regexp matching this name",
+                        false, new ListValueProvider(getDefault("type"))));
+        include
+                .addAttribute(new IvyTagAttribute(
+                        "ext",
+                        "the extension of the artifact of the \ndependency module to add to the include list, \nor a regexp matching this name",
+                        false, new ListValueProvider(getDefault("ext"))));
+        include.addAttribute(new IvyTagAttribute("matcher",
+                "the matcher to use to match the modules to include", false, matcherNamesProvider));
+        include
+                .addAttribute(new IvyTagAttribute(
+                        "conf",
+                        "comma separated list of the master configurations \nin which this artifact should be included. \n'*' wildcard can be used to designate all configurations of this module",
+                        false, masterConfsValueProvider));
+        IvyTag conf5 = new IvyTag("conf", "configuration in which the artifact should be included");
+        conf5
+                .addAttribute(new IvyTagAttribute(
+                        "name",
+                        "the name of the master configuration in which \nthe enclosing artifact should be included",
+                        true, masterConfValueProvider));
+        include.addChildIvyTag(conf5);
+        addTag(include);
+        allConf.add(conf5);
+        IvyTag exclude = new IvyTag("exclude",
+                "defines artifacts restriction \nuse only if you do not control dependency ivy file");
+        exclude
+                .addAttribute(new IvyTagAttribute(
+                        "org",
+                        "the organisation of the dependency \nmodule or artifact to exclude, \nor a pattern matching this organisation",
+                        false));
+        exclude
+                .addAttribute(new IvyTagAttribute(
+                        "module",
+                        "the name of the dependency \nmodule or the artifact to exclude, \nor a pattern matching this module name",
+                        false));
+        exclude
+                .addAttribute(new IvyTagAttribute(
+                        "name",
+                        "the name of an artifact of the \ndependency module to add to the exclude list, \nor a pattern matching this name",
+                        false));
+        exclude
+                .addAttribute(new IvyTagAttribute(
+                        "type",
+                        "the type of the artifact of the \ndependency module to add to the exclude list, \nor a pattern matching this name",
+                        false, new ListValueProvider(getDefault("type"))));
+        exclude
+                .addAttribute(new IvyTagAttribute(
+                        "ext",
+                        "the extension of the artifact of the \ndependency module to add to the exclude list, \nor a pattern matching this name",
+                        false, new ListValueProvider(getDefault("ext"))));
+        exclude.addAttribute(new IvyTagAttribute("matcher",
+                "the matcher to use to match the modules to include", false, matcherNamesProvider));
+        exclude
+                .addAttribute(new IvyTagAttribute(
+                        "conf",
+                        "comma separated list of the master configurations \nin which this artifact should be excluded. \n'*' wildcard can be used to designate all configurations of this module",
+                        false, masterConfsValueProvider));
+        IvyTag conf6 = new IvyTag("conf", "configuration in which the artifact should be excluded");
+        conf6
+                .addAttribute(new IvyTagAttribute(
+                        "name",
+                        "the name of the master configuration in which \nthe enclosing artifact should be excluded",
+                        true, masterConfValueProvider));
+        allConf.add(conf6);
+        exclude.addChildIvyTag(conf6);
+        addTag(exclude);
+        dependency.addChildIvyTag(conf3);
+        dependency.addChildIvyTag(artifact2);
+        dependency.addChildIvyTag(include);
+        dependency.addChildIvyTag(exclude);
+        dependencies.addChildIvyTag(dependency);
+        ivyTag.addChildIvyTag(dependencies);
+        addTag(dependency);
+        addTag(dependencies);
+
+        // dependencies
+
+        IvyTag conflicts = new IvyTag("conflicts", "conflicts managers definition section");
+        IvyTag manager = new IvyTag("manager", "declares a conflict manager for this module");
+        manager
+                .addAttribute(new IvyTagAttribute(
+                        "org",
+                        "the name, or a regexp matching the name of organisation \nto which this conflict manager should apply",
+                        false));
+        manager
+                .addAttribute(new IvyTagAttribute(
+                        "module",
+                        "the name, or a regexp matching the name of module \nto which this conflict manager should apply",
+                        false));
+        manager.addAttribute(new IvyTagAttribute("name", "the name of the conflict manager to use",
+                false));
+        manager.addAttribute(new IvyTagAttribute("rev",
+                "a comma separated list of revisions this conflict manager should select", false));
+        conflicts.addChildIvyTag(manager);
+        ivyTag.addChildIvyTag(conflicts);
+        addTag(conflicts);
+        addTag(manager);
+    }
+
+    protected String getRootIvyTagName() {
+        return "ivy-module";
+    }
+
+    List listDependencyTokenValues(String att, IvyFile ivyfile) {
+        Map allAttsValues = ivyfile.getAllAttsValues();
+        String org = ((IvyModuleDescriptorFile) ivyfile).getOrganisation();
+        if (org != null && !allAttsValues.containsKey("org")) {
+            allAttsValues.put("org", org);
+        }
+        return listDependencyTokenValues(att, allAttsValues);
+    }
+
+    private List listDependencyTokenValues(String att, Map otherAttValues) {
+        List ret = new ArrayList();
+        Ivy ivy = getIvy();
+        if (ivy != null) {
+            replaceToken(otherAttValues, "org", IvyPatternHelper.ORGANISATION_KEY);
+            replaceToken(otherAttValues, "name", IvyPatternHelper.MODULE_KEY);
+            replaceToken(otherAttValues, "rev", IvyPatternHelper.REVISION_KEY);
+
+            if (!otherAttValues.containsKey(IvyPatternHelper.BRANCH_KEY)) {
+                otherAttValues.put(IvyPatternHelper.BRANCH_KEY, ivy.getSettings()
+                        .getDefaultBranch());
+            }
+
+            String stdAtt = standardiseDependencyAttribute(att);
+            otherAttValues.remove(stdAtt);
+            String[] revs = ivy.listTokenValues(stdAtt, otherAttValues);
+            if (revs != null) {
+                ret.addAll(Arrays.asList(revs));
+            }
+        }
+        return ret;
+    }
+
+    private void replaceToken(Map otherAttValues, String oldToken, String newToken) {
+        String val = (String) otherAttValues.remove(oldToken);
+        if (val != null) {
+            otherAttValues.put(newToken, val);
+        }
+    }
+
+    private String standardiseDependencyAttribute(String att) {
+        if ("org".equals(att)) {
+            return IvyPatternHelper.ORGANISATION_KEY;
+        }
+        if ("name".equals(att)) {
+            return IvyPatternHelper.MODULE_KEY;
+        }
+        if ("rev".equals(att)) {
+            return IvyPatternHelper.REVISION_KEY;
+        }
+        return att;
+    }
+
+    public IvyFile newIvyFile(String name, String content, int documentOffset) {
+        return new IvyModuleDescriptorFile(getSettings(), name, content, documentOffset);
+    }
+
+}

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/ivyfile/IvyModuleDescriptorModel.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/ivyfile/IvyModuleDescriptorModel.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Copied: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/model/IValueProvider.java (from r669878, ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/core/model/IValueProvider.java)
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/model/IValueProvider.java?p2=ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/model/IValueProvider.java&p1=ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/core/model/IValueProvider.java&r1=669878&r2=679833&rev=679833&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/core/model/IValueProvider.java (original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/model/IValueProvider.java Fri Jul 25 08:26:55 2008
@@ -15,7 +15,7 @@
  *  limitations under the License.
  *
  */
-package org.apache.ivyde.eclipse.ui.core.model;
+package org.apache.ivyde.common.model;
 
 public interface IValueProvider {
     String[] getValuesfor(IvyTagAttribute att, IvyFile ivyFile);

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/model/IValueProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/model/IvyBooleanTagAttribute.java (from r669878, ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/core/model/IvyBooleanTagAttribute.java)
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/model/IvyBooleanTagAttribute.java?p2=ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/model/IvyBooleanTagAttribute.java&p1=ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/core/model/IvyBooleanTagAttribute.java&r1=669878&r2=679833&rev=679833&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/core/model/IvyBooleanTagAttribute.java (original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/model/IvyBooleanTagAttribute.java Fri Jul 25 08:26:55 2008
@@ -15,13 +15,13 @@
  *  limitations under the License.
  *
  */
-package org.apache.ivyde.eclipse.ui.core.model;
+package org.apache.ivyde.common.model;
 
 public class IvyBooleanTagAttribute extends IvyTagAttribute {
 
     protected static final String[] BOOLEAN_VALUES = new String[] {"true", "false"};
 
-    private static final IValueProvider VALUE_PROVIDER = new IValueProvider() {
+    public static final IValueProvider VALUE_PROVIDER = new IValueProvider() {
         public String[] getValuesfor(IvyTagAttribute att, IvyFile ivyFile) {
             return BOOLEAN_VALUES;
         }

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/model/IvyBooleanTagAttribute.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/model/IvyFile.java (from r669878, ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/core/model/IvyFile.java)
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/model/IvyFile.java?p2=ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/model/IvyFile.java&p1=ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/core/model/IvyFile.java&r1=669878&r2=679833&rev=679833&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/core/model/IvyFile.java (original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/model/IvyFile.java Fri Jul 25 08:26:55 2008
@@ -15,20 +15,15 @@
  *  limitations under the License.
  *
  */
-package org.apache.ivyde.eclipse.ui.core.model;
+package org.apache.ivyde.common.model;
 
-import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
 import java.util.Stack;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
-import org.apache.ivyde.eclipse.IvyPlugin;
-import org.eclipse.core.runtime.IStatus;
-
-public class IvyFile {
+public abstract class IvyFile {
     private static final Pattern ATTRIBUTE_NAME_PATTERN = Pattern
             .compile("[^\"]*\"[\\s]*=[\\s]*([\\w\\-]+)");
 
@@ -37,14 +32,6 @@
     private static final Pattern ATTRIBUTE_VALUE_PATTERN = Pattern
             .compile("([a-zA-Z0-9]+)[ ]*=[ ]*\"([^\"]*)\"");
 
-    private static final Pattern CONF_PATTERN = Pattern.compile("<[\\s]*conf[^>]+name=\"([^\"]+)");
-
-    private static final Pattern CONFIGURATIONS_END_PATTERN = Pattern
-            .compile("</[\\s]*configurations[\\s]*>");
-
-    private static final Pattern CONFIGURATIONS_START_PATTERN = Pattern
-            .compile("<[\\s]*configurations[\\s]*>");
-
     private String _doc;
 
     private int _currentOffset;
@@ -53,38 +40,30 @@
 
     private String _projectName;
 
-    public IvyFile(String projectName, String doc) {
-        this(projectName, doc, 0);
+    private IvyModelSettings settings;
+
+    public IvyFile(IvyModelSettings settings, String projectName, String doc) {
+        this(settings, projectName, doc, 0);
     }
 
-    public IvyFile(String projectName, String doc, int currentOffset) {
+    public IvyFile(IvyModelSettings settings, String projectName, String doc, int currentOffset) {
+        this.settings = settings;
         _projectName = projectName;
         _doc = doc;
         _reversed = new StringBuffer(doc).reverse().toString();
         _currentOffset = currentOffset;
     }
 
-    public String[] getConfigurationNames() {
-        Pattern p = CONFIGURATIONS_START_PATTERN;
-        Matcher m = p.matcher(_doc);
-        if (m.find()) {
-            int start = m.end();
-            p = CONFIGURATIONS_END_PATTERN;
-            m = p.matcher(_doc);
-            int end = _doc.length();
-            if (m.find(start)) {
-                end = m.start();
-            }
-            p = CONF_PATTERN;
-            m = p.matcher(_doc);
-            List ret = new ArrayList();
-            for (boolean found = m.find(start); found && m.end() < end; found = m.find()) {
-                ret.add(m.group(1));
-            }
-            return (String[]) ret.toArray(new String[ret.size()]);
-        } else {
-            return new String[] {"default"};
-        }
+    protected String getDoc() {
+        return _doc;
+    }
+    
+    protected int getCurrentOffset() {
+        return _currentOffset;
+    }
+    
+    protected String getReversedDoc() {
+        return _reversed;
     }
 
     public boolean inTag() {
@@ -204,56 +183,13 @@
             }
         } catch (Exception e) {
             // FIXME : what is really catched here ?
-            IvyPlugin.log(IStatus.WARNING, "Something bad happened", e);
+            if (settings != null) {
+                settings.logError("Something bad happened", e);
+            }
         }
         return result;
     }
 
-    // public Map getAllAttsValues(int documentOffset) {
-    // Map result = new HashMap();
-    // int offset = documentOffset;
-    // int start = -1;
-    // int end = -1;
-    // char c = ' ';
-    // // move cursor at the begining of the tag
-    // while (c != '<') {
-    // try {
-    // c = _doc.charAt(--offset);
-    // } catch (IndexOutOfBoundsException e) {
-    // offset = 0;
-    // break;
-    // }
-    // }
-    // start = offset;
-    // offset = documentOffset;
-    // while (c != '>') {
-    // try {
-    // c = _doc.charAt(++offset);
-    // } catch (IndexOutOfBoundsException e) {
-    // break;
-    // }
-    // }
-    // end = offset;
-    // Pattern regexp = ATTRIBUTE_VALUE_PATTERN;
-    // try {
-    // String tag = _doc.substring(start, end);
-    // tag = tag.substring(tag.indexOf(' '));
-    // Matcher m = regexp.matcher(tag);
-    // while (m.find()) {
-    // String key = m.group(1);
-    // String val = m.group(2);
-    // result.put(key, val);
-    // if (m.end() + m.group(0).length() < tag.length()) {
-    // tag = tag.substring(m.end());
-    // m = regexp.matcher(tag);
-    // }
-    // }
-    // } catch (Exception e) {
-    // e.printStackTrace();
-    // }
-    // return result;
-    // }
-    //    
     public String getQualifier() {
         return getQualifier(_currentOffset);
     }
@@ -397,7 +333,9 @@
                 }
             } catch (IndexOutOfBoundsException e) {
                 // FIXME hu ? need some comments
-                IvyPlugin.log(IStatus.WARNING, "Something bad happened", e);
+                if (settings != null) {
+                    settings.logError("Something bad happened", e);
+                }
                 return null;
             }
         }
@@ -418,24 +356,4 @@
     public String getProjectName() {
         return _projectName;
     }
-
-    public String getOrganisation() {
-        Pattern p = Pattern.compile("<[\\s]*info[^>]*organisation[\\s]*=[\\s]*\"([^\"]+)");
-        Matcher m = p.matcher(_doc);
-        if (m.find()) {
-            return m.group(1);
-        }
-        return null;
-    }
-
-    public String getDependencyOrganisation() {
-        Map otherAttValues = getAllAttsValues();
-        return getDependencyOrganisation(otherAttValues);
-    }
-
-    public String getDependencyOrganisation(Map otherAttValues) {
-        return otherAttValues != null && otherAttValues.get("org") != null ? (String) otherAttValues
-                .get("org")
-                : getOrganisation();
-    }
 }

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/model/IvyFile.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message