Author: hibou Date: Sun Jul 28 21:19:51 2013 New Revision: 1507850 URL: http://svn.apache.org/r1507850 Log: Add the extensions so easyant4e can fit into IvyDE (code from Jérôme Benois)
Added: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/schema/ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/schema/editorPage.exsd (with props) ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/schema/moduleDescriptorExtension.exsd (with props) ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/model/IDocumentedValueProvider.java (with props) ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/extension/ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/extension/IvyEditorPage.java (with props) ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/extension/IvyEditorPageDescriptor.java (with props) ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/extension/ModuleDescriptorExtension.java (with props) ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/extension/ModuleDescriptorExtensionDescriptor.java (with props) Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/META-INF/MANIFEST.MF ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/build.properties ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/plugin.xml ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/completion/IvyCodeCompletionProcessor.java ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/ivyfile/IvyModuleDescriptorModel.java ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/model/IvyModel.java ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/model/IvyTag.java ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/console/IvyConsole.java ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/IvyModuleDescriptorEditor.java ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLConfiguration.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=1507850&r1=1507849&r2=1507850&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 Sun Jul 28 21:19:51 2013 @@ -6,16 +6,29 @@ Bundle-Version: 2.2.0.qualifier Bundle-ClassPath: ivyde-eclipse.jar Bundle-Activator: org.apache.ivyde.eclipse.IvyPlugin Bundle-Vendor: Apache Software Foundation -Export-Package: org.apache.ivyde.eclipse, +Export-Package: org.apache.ivyde.common.completion, + org.apache.ivyde.common.ivyfile, + org.apache.ivyde.common.ivysettings, + org.apache.ivyde.common.model, + org.apache.ivyde.eclipse, + org.apache.ivyde.eclipse.conditions, org.apache.ivyde.eclipse.cpcontainer, + org.apache.ivyde.eclipse.extension, + org.apache.ivyde.eclipse.handlers, + org.apache.ivyde.eclipse.resolve, + org.apache.ivyde.eclipse.retrieve, + org.apache.ivyde.eclipse.revdepexplorer, + org.apache.ivyde.eclipse.ui, org.apache.ivyde.eclipse.ui.console, org.apache.ivyde.eclipse.ui.core, org.apache.ivyde.eclipse.ui.editors, org.apache.ivyde.eclipse.ui.editors.pages, org.apache.ivyde.eclipse.ui.editors.xml, + org.apache.ivyde.eclipse.ui.menu, org.apache.ivyde.eclipse.ui.preferences, org.apache.ivyde.eclipse.ui.views, - org.apache.ivyde.eclipse.ui.wizards + org.apache.ivyde.eclipse.ui.wizards, + org.apache.ivyde.eclipse.workspaceresolver Require-Bundle: org.apache.xerces;bundle-version="[2.9.0,3.0.0)";resolution:=optional, org.eclipse.ui;bundle-version="[3.4.0,4.0.0)", org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)", Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/build.properties URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/build.properties?rev=1507850&r1=1507849&r2=1507850&view=diff ============================================================================== --- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/build.properties (original) +++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/build.properties Sun Jul 28 21:19:51 2013 @@ -24,7 +24,8 @@ bin.includes = plugin.xml,\ META-INF/,\ doc/,\ xsd/,\ - about.ini + about.ini,\ + schema/ module.type = tools @@ -45,4 +46,6 @@ src.includes = plugin.xml,\ .settings/,\ META-INF/,\ xsd/,\ - about.ini + about.ini,\ + schema/,\ + doc/ 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=1507850&r1=1507849&r2=1507850&view=diff ============================================================================== --- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/plugin.xml (original) +++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/plugin.xml Sun Jul 28 21:19:51 2013 @@ -19,6 +19,9 @@ under the License. --> <plugin> + <extension-point id="moduleDescriptorExtension" name="org.apache.ivyde.module.descriptor.extension" schema="schema/moduleDescriptorExtension.exsd"/> + <extension-point id="editorPage" name="org.apache.ivyde.editorPage" schema="schema/editorPage.exsd"/> + <extension point="org.eclipse.ui.console.consoleFactories"> <consoleFactory label="Ivy Console" Added: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/schema/editorPage.exsd URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/schema/editorPage.exsd?rev=1507850&view=auto ============================================================================== Binary file - no diff available. Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/schema/editorPage.exsd ------------------------------------------------------------------------------ svn:mime-type = application/xml Added: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/schema/moduleDescriptorExtension.exsd URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/schema/moduleDescriptorExtension.exsd?rev=1507850&view=auto ============================================================================== Binary file - no diff available. Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/schema/moduleDescriptorExtension.exsd ------------------------------------------------------------------------------ svn:mime-type = application/xml Modified: 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=1507850&r1=1507849&r2=1507850&view=diff ============================================================================== --- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/completion/IvyCodeCompletionProcessor.java (original) +++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/completion/IvyCodeCompletionProcessor.java Sun Jul 28 21:19:51 2013 @@ -135,8 +135,15 @@ public class IvyCodeCompletionProcessor 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()); + CodeCompletionProposal proposal = null; + String doc = ivyTag.getPossibleDocForValue(val, ivyfile); + if (doc == null) { + proposal = new CodeCompletionProposal(val, ivyfile.getOffset() - qlen, qlen + + caretOffset, val.length()); + } else { + proposal = new CodeCompletionProposal(val, ivyfile.getOffset() - qlen, qlen + + caretOffset, val.length(), val, doc); + } propList.add(proposal); } } Modified: 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=1507850&r1=1507849&r2=1507850&view=diff ============================================================================== --- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/ivyfile/IvyModuleDescriptorModel.java (original) +++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/ivyfile/IvyModuleDescriptorModel.java Sun Jul 28 21:19:51 2013 @@ -93,6 +93,39 @@ public class IvyModuleDescriptorModel ex new IvyTagAttribute("revision", "the revision of this module."), statusTagAttribute, pubTagAttribute}); addTag(info); + + // extends + IvyTag extend = new IvyTag("extends", "gives information about the parent module"); + IvyTagAttribute parentOrgAtt = new IvyTagAttribute("organisation", + "the name of the organisation of the parent module.", false); + parentOrgAtt.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()]); + } + }); + extend.addAttribute(parentOrgAtt); + IvyTagAttribute parentModuleAtt = new IvyTagAttribute("module", + "the module name of the parent module", true); + parentModuleAtt.setValueProvider(new IValueProvider() { + public String[] getValuesfor(IvyTagAttribute att, IvyFile ivyFile) { + List ret = listDependencyTokenValues(att.getName(), ivyFile); + return (String[]) ret.toArray(new String[ret.size()]); + } + }); + extend.addAttribute(parentModuleAtt); + IvyTagAttribute parentRevAtt = new IvyTagAttribute("revision", + "the revision of the parent module"); + extend.addAttribute(parentRevAtt); + addTag(extend); + info.addChildIvyTag(extend); + + // license IvyTag child = new IvyTag("license", "gives information about the licenses of the described module"); child.addAttribute(new IvyTagAttribute("name", "the name of the license. \n" Added: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/model/IDocumentedValueProvider.java URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/model/IDocumentedValueProvider.java?rev=1507850&view=auto ============================================================================== --- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/model/IDocumentedValueProvider.java (added) +++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/model/IDocumentedValueProvider.java Sun Jul 28 21:19:51 2013 @@ -0,0 +1,24 @@ +/* + * 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.model; + +public interface IDocumentedValueProvider extends IValueProvider { + + String getDocForValue(String value, IvyFile ivyFile); + +} Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/model/IDocumentedValueProvider.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/model/IDocumentedValueProvider.java ------------------------------------------------------------------------------ svn:keywords = Date Revision Author HeadURL Id Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/model/IDocumentedValueProvider.java ------------------------------------------------------------------------------ svn:mime-type = text/plain Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/model/IvyModel.java URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/model/IvyModel.java?rev=1507850&r1=1507849&r2=1507850&view=diff ============================================================================== --- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/model/IvyModel.java (original) +++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/model/IvyModel.java Sun Jul 28 21:19:51 2013 @@ -81,7 +81,7 @@ public abstract class IvyModel { model.put(name, list); } - protected void addTag(IvyTag ivyTag) { + public void addTag(IvyTag ivyTag) { if (!model.containsKey(ivyTag.getName())) { model.put(ivyTag.getName(), ivyTag); for (Iterator it = ivyTag.getChilds().iterator(); it.hasNext();) { Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/model/IvyTag.java URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/model/IvyTag.java?rev=1507850&r1=1507849&r2=1507850&view=diff ============================================================================== --- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/model/IvyTag.java (original) +++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/model/IvyTag.java Sun Jul 28 21:19:51 2013 @@ -27,9 +27,9 @@ import java.util.ResourceBundle; import java.util.Set; public class IvyTag { - private static final ResourceBundle DOC_RESOURCE = ResourceBundle.getBundle( - IvyTag.class.getPackage().getName() + ".tagsdoc"); - + private static final ResourceBundle DOC_RESOURCE = ResourceBundle.getBundle(IvyTag.class + .getPackage().getName() + ".tagsdoc"); + private IvyTag parent; private String name; @@ -174,6 +174,20 @@ public class IvyTag { return null; } + public String getPossibleDocForValue(String value, IvyFile ivyfile) { + IvyTagAttribute ivyTagAttribute = (IvyTagAttribute) attributes.get(ivyfile + .getAttributeName()); + if (ivyTagAttribute == null) { + return null; + } + IValueProvider provider = ivyTagAttribute.getValueProvider(); + if (provider != null && (provider instanceof IDocumentedValueProvider)) { + String doc = ((IDocumentedValueProvider) provider).getDocForValue(value, ivyfile); + return doc; + } + return null; + } + public boolean isAllowNoChild() { return allowNoChild; } Added: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/extension/IvyEditorPage.java URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/extension/IvyEditorPage.java?rev=1507850&view=auto ============================================================================== --- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/extension/IvyEditorPage.java (added) +++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/extension/IvyEditorPage.java Sun Jul 28 21:19:51 2013 @@ -0,0 +1,28 @@ +/* + * 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.eclipse.extension; + +import org.eclipse.ui.forms.editor.IFormPage; + +public interface IvyEditorPage extends IFormPage { + + public final static String EXTENSION_POINT = "org.apache.ivyde.eclipse.editorPage"; + + public String getPageName(); + +} Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/extension/IvyEditorPage.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/extension/IvyEditorPage.java ------------------------------------------------------------------------------ svn:keywords = Date Revision Author HeadURL Id Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/extension/IvyEditorPage.java ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/extension/IvyEditorPageDescriptor.java URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/extension/IvyEditorPageDescriptor.java?rev=1507850&view=auto ============================================================================== --- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/extension/IvyEditorPageDescriptor.java (added) +++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/extension/IvyEditorPageDescriptor.java Sun Jul 28 21:19:51 2013 @@ -0,0 +1,57 @@ +/* + * 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.eclipse.extension; + +import org.apache.ivyde.eclipse.IvyPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IStatus; + +/** + * A factory proxy for creating a IFormPage contributed to Ivy module descriptor editor. + */ +public class IvyEditorPageDescriptor { + + private static final String ID_ATTRIBUTE = "id"; + + private static final String CLASS_ATTRIBUTE = "pageClass"; + + private IConfigurationElement element; + + public IvyEditorPageDescriptor(final IConfigurationElement element) { + this.element = element; + } + + public IvyEditorPage createPage() { + try { + return (IvyEditorPage) element.createExecutableExtension(CLASS_ATTRIBUTE); + } catch (final CoreException e) { + IvyPlugin.log(IStatus.ERROR, + "Impossible to create the page " + element.getAttribute(CLASS_ATTRIBUTE), e); + } catch (final ClassCastException e) { + IvyPlugin.log(IStatus.ERROR, + "Impossible to create the page " + element.getAttribute(CLASS_ATTRIBUTE), e); + } + return null; + } + + public String getId() { + return element.getAttribute(ID_ATTRIBUTE); + } + +} Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/extension/IvyEditorPageDescriptor.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/extension/IvyEditorPageDescriptor.java ------------------------------------------------------------------------------ svn:keywords = Date Revision Author HeadURL Id Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/extension/IvyEditorPageDescriptor.java ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/extension/ModuleDescriptorExtension.java URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/extension/ModuleDescriptorExtension.java?rev=1507850&view=auto ============================================================================== --- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/extension/ModuleDescriptorExtension.java (added) +++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/extension/ModuleDescriptorExtension.java Sun Jul 28 21:19:51 2013 @@ -0,0 +1,29 @@ +/* + * 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.eclipse.extension; + +import org.apache.ivyde.common.ivyfile.IvyModuleDescriptorModel; + +public interface ModuleDescriptorExtension { + + public final static String EXTENSION_POINT = "org.apache.ivyde.eclipse.moduleDescriptorExtension"; + + public IvyModuleDescriptorModel contributeModel( + IvyModuleDescriptorModel ivyModuleDescriptorModel); + +} Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/extension/ModuleDescriptorExtension.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/extension/ModuleDescriptorExtension.java ------------------------------------------------------------------------------ svn:keywords = Date Revision Author HeadURL Id Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/extension/ModuleDescriptorExtension.java ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/extension/ModuleDescriptorExtensionDescriptor.java URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/extension/ModuleDescriptorExtensionDescriptor.java?rev=1507850&view=auto ============================================================================== --- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/extension/ModuleDescriptorExtensionDescriptor.java (added) +++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/extension/ModuleDescriptorExtensionDescriptor.java Sun Jul 28 21:19:51 2013 @@ -0,0 +1,57 @@ +/* + * 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.eclipse.extension; + +import org.apache.ivyde.eclipse.IvyPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IStatus; + +/** + * A factory proxy for creating a ModuleDescriptorExtension. + */ +public class ModuleDescriptorExtensionDescriptor { + private static final String ID_ATTRIBUTE = "id"; + + public static final String MODEL_CONTRIBUTOR_CLASS_ATTRIBUTE = "modelContributorClass"; + + private IConfigurationElement element; + + public ModuleDescriptorExtensionDescriptor(final IConfigurationElement element) { + this.element = element; + } + + public ModuleDescriptorExtension createModuleDescriptorExtension() { + try { + return (ModuleDescriptorExtension) element + .createExecutableExtension(MODEL_CONTRIBUTOR_CLASS_ATTRIBUTE); + } catch (final CoreException e) { + IvyPlugin.log(IStatus.ERROR, "Impossible to create the module descriptor extension " + + element.getAttribute(MODEL_CONTRIBUTOR_CLASS_ATTRIBUTE), e); + } catch (final ClassCastException e) { + IvyPlugin.log(IStatus.ERROR, "Impossible to create the module descriptor extension " + + element.getAttribute(MODEL_CONTRIBUTOR_CLASS_ATTRIBUTE), e); + } + return null; + } + + public String getId() { + return element.getAttribute(ID_ATTRIBUTE); + } + +} Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/extension/ModuleDescriptorExtensionDescriptor.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/extension/ModuleDescriptorExtensionDescriptor.java ------------------------------------------------------------------------------ svn:keywords = Date Revision Author HeadURL Id Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/extension/ModuleDescriptorExtensionDescriptor.java ------------------------------------------------------------------------------ svn:mime-type = text/plain Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/console/IvyConsole.java URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/console/IvyConsole.java?rev=1507850&r1=1507849&r2=1507850&view=diff ============================================================================== --- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/console/IvyConsole.java (original) +++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/console/IvyConsole.java Sun Jul 28 21:19:51 2013 @@ -26,6 +26,7 @@ import org.apache.ivy.util.MessageLogger import org.apache.ivyde.eclipse.IvyDEMessageLogger; import org.apache.ivyde.eclipse.IvyPlugin; import org.eclipse.jface.preference.PreferenceConverter; +import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.widgets.Display; @@ -71,7 +72,11 @@ public class IvyConsole extends MessageC private IvyDEMessageLogger ivyDEMessageLogger; public IvyConsole() { - super("Ivy", IvyPlugin.getImageDescriptor("icons/logo16x16.gif")); //$NON-NLS-1$ + this("Ivy", IvyPlugin.getImageDescriptor("icons/logo16x16.gif")); //$NON-NLS-1$ + } + + public IvyConsole(String name, ImageDescriptor imageDescriptor) { + super(name, imageDescriptor); consoleManager = ConsolePlugin.getDefault().getConsoleManager(); document = new ConsoleDocument(); Message.setDefaultLogger(this); Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/IvyModuleDescriptorEditor.java URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/IvyModuleDescriptorEditor.java?rev=1507850&r1=1507849&r2=1507850&view=diff ============================================================================== --- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/IvyModuleDescriptorEditor.java (original) +++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/IvyModuleDescriptorEditor.java Sun Jul 28 21:19:51 2013 @@ -17,9 +17,18 @@ */ package org.apache.ivyde.eclipse.ui.editors; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + import org.apache.ivyde.common.ivyfile.IvyModuleDescriptorModel; import org.apache.ivyde.common.model.IvyModel; +import org.apache.ivyde.common.model.IvyModelSettings; import org.apache.ivyde.eclipse.IvyPlugin; +import org.apache.ivyde.eclipse.extension.IvyEditorPage; +import org.apache.ivyde.eclipse.extension.IvyEditorPageDescriptor; +import org.apache.ivyde.eclipse.extension.ModuleDescriptorExtension; +import org.apache.ivyde.eclipse.extension.ModuleDescriptorExtensionDescriptor; import org.apache.ivyde.eclipse.ui.core.IvyFileEditorInput; import org.apache.ivyde.eclipse.ui.editors.pages.OverviewFormPage; import org.apache.ivyde.eclipse.ui.editors.xml.EclipseIvyModelSettings; @@ -31,7 +40,11 @@ import org.eclipse.core.resources.IResou import org.eclipse.core.resources.IResourceChangeEvent; import org.eclipse.core.resources.IResourceChangeListener; import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IExtension; import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Platform; import org.eclipse.jface.dialogs.ErrorDialog; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.swt.SWT; @@ -55,12 +68,44 @@ public class IvyModuleDescriptorEditor e private Browser browser; + private List/* <IvyEditorPageDescriptor> */ivyEditorPageDescriptors = new ArrayList(); + + private List/* <ModuleDescriptorExtensionDescriptor> */moduleDescriptorExtensionDescriptors = new ArrayList(); + /** * Creates a multi-page editor example. */ public IvyModuleDescriptorEditor() { super(); ResourcesPlugin.getWorkspace().addResourceChangeListener(this); + parseModuleDescriptorExtensionMetadatas(); + parseEditorPageExtensionMetadatas(); + } + + private void parseModuleDescriptorExtensionMetadatas() { + final IExtension[] extensions = Platform.getExtensionRegistry() + .getExtensionPoint(ModuleDescriptorExtension.EXTENSION_POINT).getExtensions(); + for (int i = 0; i < extensions.length; i++) { + final IConfigurationElement[] configElements = extensions[i].getConfigurationElements(); + for (int j = 0; j < configElements.length; j++) { + final ModuleDescriptorExtensionDescriptor descriptor = new ModuleDescriptorExtensionDescriptor( + configElements[j]); + moduleDescriptorExtensionDescriptors.add(descriptor); + } + } + } + + private void parseEditorPageExtensionMetadatas() { + final IExtension[] extensions = Platform.getExtensionRegistry() + .getExtensionPoint(IvyEditorPage.EXTENSION_POINT).getExtensions(); + for (int i = 0; i < extensions.length; i++) { + final IConfigurationElement[] configElements = extensions[i].getConfigurationElements(); + for (int j = 0; j < configElements.length; j++) { + final IvyEditorPageDescriptor descriptor = new IvyEditorPageDescriptor( + configElements[j]); + ivyEditorPageDescriptors.add(descriptor); + } + } } protected void setInput(IEditorInput input) { @@ -85,8 +130,7 @@ public class IvyModuleDescriptorEditor e try { xmlEditor = new XMLEditor(new IvyContentAssistProcessor() { protected IvyModel newCompletionModel(IFile file) { - return new IvyModuleDescriptorModel(new EclipseIvyModelSettings( - file)); + return getIvyCompletionModel(new EclipseIvyModelSettings(file)); } }); xmlEditor.setFile(((IvyFileEditorInput) getEditorInput()).getFile()); @@ -98,6 +142,23 @@ public class IvyModuleDescriptorEditor e } } + private IvyModuleDescriptorModel getIvyCompletionModel(IvyModelSettings ivyModelSettings) { + IvyModuleDescriptorModel ivyModuleDescriptorModel = new IvyModuleDescriptorModel( + ivyModelSettings); + Iterator iterator = moduleDescriptorExtensionDescriptors.iterator(); + while (iterator.hasNext()) { + ModuleDescriptorExtensionDescriptor descriptor = (ModuleDescriptorExtensionDescriptor) iterator + .next(); + ModuleDescriptorExtension moduleDescriptorExtension = descriptor + .createModuleDescriptorExtension(); + if (moduleDescriptorExtension != null) { + ivyModuleDescriptorModel = moduleDescriptorExtension + .contributeModel(ivyModuleDescriptorModel); + } + } + return ivyModuleDescriptorModel; + } + void createPageOverView() { try { int index = addPage(new OverviewFormPage(this)); @@ -118,8 +179,8 @@ public class IvyModuleDescriptorEditor e } catch (SWTError e) { // IVYDE-10: under Linux if MOZILLA_FIVE_HOME is not set, it fails badly MessageDialog.openError(IvyPlugin.getActiveWorkbenchShell(), - "Fail to create the preview", "The page preview could not be created :" - + e.getMessage()); + "Fail to create the preview", + "The page preview could not be created :" + e.getMessage()); IvyPlugin.logError("The preview page in the ivy.xml editor could not be created", e); } } @@ -131,6 +192,24 @@ public class IvyModuleDescriptorEditor e // createPageOverView(); createPageXML(); // createPagePreview(); + addIvyEditorPageExtensions(); + } + + private void addIvyEditorPageExtensions() { + Iterator iterator = ivyEditorPageDescriptors.iterator(); + while (iterator.hasNext()) { + IvyEditorPageDescriptor ivyEditorPageDescriptor = (IvyEditorPageDescriptor) iterator + .next(); + IvyEditorPage page = ivyEditorPageDescriptor.createPage(); + try { + page.initialize(this); + int pageIndex = addPage(page); + setPageText(pageIndex, page.getPageName()); + } catch (PartInitException e) { + IvyPlugin.log(IStatus.ERROR, "Cannot add Ivy editor extension", e); + } + } + } /** @@ -184,7 +263,7 @@ public class IvyModuleDescriptorEditor e */ protected void pageChange(int newPageIndex) { super.pageChange(newPageIndex); - if (newPageIndex == 1) { + if (newPageIndex == 1 && browser != null) { browser.refresh(); } } @@ -201,8 +280,7 @@ public class IvyModuleDescriptorEditor e for (int i = 0; i < pages.length; i++) { if (((IFileEditorInput) xmlEditor.getEditorInput()).getFile().getProject() .equals(res)) { - IEditorPart editorPart = pages[i] - .findEditor(xmlEditor.getEditorInput()); + IEditorPart editorPart = pages[i].findEditor(xmlEditor.getEditorInput()); pages[i].closeEditor(editorPart, true); } } Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLConfiguration.java URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLConfiguration.java?rev=1507850&r1=1507849&r2=1507850&view=diff ============================================================================== --- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLConfiguration.java (original) +++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLConfiguration.java Sun Jul 28 21:19:51 2013 @@ -113,7 +113,7 @@ public class XMLConfiguration extends So // required to display additional info assistant.setInformationControlCreator(new IInformationControlCreator() { public IInformationControl createInformationControl(Shell parent) { - return new DefaultInformationControl(parent); + return new DefaultInformationControl(parent, true); } });