You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by xa...@apache.org on 2008/01/14 11:26:52 UTC
svn commit: r611752 [8/11] - in /ant/ivy/ivyde/trunk: ./ .settings/ doc/
doc/style/ src/java/org/apache/ivyde/eclipse/
src/java/org/apache/ivyde/eclipse/cpcontainer/
src/java/org/apache/ivyde/eclipse/cpcontainer/fragmentinfo/
src/java/org/apache/ivyde/...
Modified: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/core/model/IvyTagAttribute.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/core/model/IvyTagAttribute.java?rev=611752&r1=611751&r2=611752&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/core/model/IvyTagAttribute.java (original)
+++ ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/core/model/IvyTagAttribute.java Mon Jan 14 02:26:37 2008
@@ -1,86 +1,91 @@
-package org.apache.ivyde.eclipse.ui.core.model;
-
-public class IvyTagAttribute {
- private IvyTag _container;
- private String _name;
- private String _doc = "";
- private boolean _mandatory = false;
- private IValueProvider _valueProvider = null;
- /**
- * @param name
- */
- public IvyTagAttribute(String name) {
- super();
- _name = name;
- }
-
- public IvyTagAttribute(String name, IValueProvider vp) {
- super();
- _name = name;
- _valueProvider = vp;
- }
-
- public IvyTagAttribute(String name, String doc) {
- super();
- _name = name;
- _doc = doc;
- }
-
- public IvyTagAttribute(String name, String doc, boolean mandatory) {
- super();
- _name = name;
- _doc = doc;
- _mandatory = mandatory;
- }
-
- public IvyTagAttribute(String name, String doc, boolean mandatory, IValueProvider provider) {
- _name = name;
- _doc = doc;
- _mandatory = mandatory;
- _valueProvider = provider;
- }
-
- public String getName() {
- return _name;
- }
-
- public void setName(String name) {
- _name = name;
- }
-
- public String toString() {
- return _name;
- }
-
- public String getDoc() {
- return _doc;
- }
-
- public void setDoc(String doc) {
- _doc = doc;
- }
-
- public IvyTag getContainer() {
- return _container;
- }
-
- public void setContainer(IvyTag container) {
- _container = container;
- }
-
- public boolean isMandatory() {
- return _mandatory;
- }
-
- public void setMandatory(boolean mandatory) {
- _mandatory = mandatory;
- }
-
- public IValueProvider getValueProvider() {
- return _valueProvider;
- }
-
- public void setValueProvider(IValueProvider valueProvider) {
- _valueProvider = valueProvider;
- }
-}
+package org.apache.ivyde.eclipse.ui.core.model;
+
+public class IvyTagAttribute {
+ private IvyTag _container;
+
+ private String _name;
+
+ private String _doc = "";
+
+ private boolean _mandatory = false;
+
+ private IValueProvider _valueProvider = null;
+
+ /**
+ * @param name
+ */
+ public IvyTagAttribute(String name) {
+ super();
+ _name = name;
+ }
+
+ public IvyTagAttribute(String name, IValueProvider vp) {
+ super();
+ _name = name;
+ _valueProvider = vp;
+ }
+
+ public IvyTagAttribute(String name, String doc) {
+ super();
+ _name = name;
+ _doc = doc;
+ }
+
+ public IvyTagAttribute(String name, String doc, boolean mandatory) {
+ super();
+ _name = name;
+ _doc = doc;
+ _mandatory = mandatory;
+ }
+
+ public IvyTagAttribute(String name, String doc, boolean mandatory, IValueProvider provider) {
+ _name = name;
+ _doc = doc;
+ _mandatory = mandatory;
+ _valueProvider = provider;
+ }
+
+ public String getName() {
+ return _name;
+ }
+
+ public void setName(String name) {
+ _name = name;
+ }
+
+ public String toString() {
+ return _name;
+ }
+
+ public String getDoc() {
+ return _doc;
+ }
+
+ public void setDoc(String doc) {
+ _doc = doc;
+ }
+
+ public IvyTag getContainer() {
+ return _container;
+ }
+
+ public void setContainer(IvyTag container) {
+ _container = container;
+ }
+
+ public boolean isMandatory() {
+ return _mandatory;
+ }
+
+ public void setMandatory(boolean mandatory) {
+ _mandatory = mandatory;
+ }
+
+ public IValueProvider getValueProvider() {
+ return _valueProvider;
+ }
+
+ public void setValueProvider(IValueProvider valueProvider) {
+ _valueProvider = valueProvider;
+ }
+}
Propchange: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/core/model/IvyTagAttribute.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/core/model/ListValueProvider.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/core/model/ListValueProvider.java?rev=611752&r1=611751&r2=611752&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/core/model/ListValueProvider.java (original)
+++ ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/core/model/ListValueProvider.java Mon Jan 14 02:26:37 2008
@@ -1,39 +1,39 @@
-/*
- * This file is given under the licence found in LICENCE.TXT in the root directory of the project.
- *
- * #SNAPSHOT#
- */
-package org.apache.ivyde.eclipse.ui.core.model;
-
-public class ListValueProvider implements IValueProvider {
-
- private String[] _values;
-
- public ListValueProvider(String commaSeparatedValuesList) {
- if (commaSeparatedValuesList != null) {
- init(commaSeparatedValuesList.split(","), true);
- }
- }
-
- public ListValueProvider(String[] values) {
- if (values != null) {
- init(values, false);
- }
- }
-
- private void init(String[] values, boolean trim) {
- _values = new String[values.length];
- if (trim) {
- for (int i = 0; i < values.length; i++) {
- _values[i] = values[i].trim();
- }
- } else {
- System.arraycopy(values, 0, _values, 0, values.length);
- }
- }
-
- public String[] getValuesfor(IvyTagAttribute att, IvyFile ivyFile) {
- return _values;
- }
-
-}
+/*
+ * This file is given under the licence found in LICENCE.TXT in the root directory of the project.
+ *
+ * #SNAPSHOT#
+ */
+package org.apache.ivyde.eclipse.ui.core.model;
+
+public class ListValueProvider implements IValueProvider {
+
+ private String[] _values;
+
+ public ListValueProvider(String commaSeparatedValuesList) {
+ if (commaSeparatedValuesList != null) {
+ init(commaSeparatedValuesList.split(","), true);
+ }
+ }
+
+ public ListValueProvider(String[] values) {
+ if (values != null) {
+ init(values, false);
+ }
+ }
+
+ private void init(String[] values, boolean trim) {
+ _values = new String[values.length];
+ if (trim) {
+ for (int i = 0; i < values.length; i++) {
+ _values[i] = values[i].trim();
+ }
+ } else {
+ System.arraycopy(values, 0, _values, 0, values.length);
+ }
+ }
+
+ public String[] getValuesfor(IvyTagAttribute att, IvyFile ivyFile) {
+ return _values;
+ }
+
+}
Propchange: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/core/model/ListValueProvider.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/core/model/PreferenceValueProvider.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/core/model/PreferenceValueProvider.java?rev=611752&r1=611751&r2=611752&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/core/model/PreferenceValueProvider.java (original)
+++ ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/core/model/PreferenceValueProvider.java Mon Jan 14 02:26:37 2008
@@ -1,22 +1,24 @@
-/*
- * This file is given under the licence found in LICENCE.TXT in the root directory of the project.
- *
- * #SNAPSHOT#
- */
-package org.apache.ivyde.eclipse.ui.core.model;
-
-import org.apache.ivyde.eclipse.IvyPlugin;
-
-final class PreferenceValueProvider implements IValueProvider {
- private String _name;
- public PreferenceValueProvider(String name) {
- _name = name;
- }
- public String[] getValuesfor(IvyTagAttribute att, IvyFile ivyFile) {
- try {
- return new String[] {IvyPlugin.getDefault().getPreferenceStore().getString(_name) };
- } catch (Exception e) {
- return null;
- }
- }
-}
\ No newline at end of file
+/*
+ * This file is given under the licence found in LICENCE.TXT in the root directory of the project.
+ *
+ * #SNAPSHOT#
+ */
+package org.apache.ivyde.eclipse.ui.core.model;
+
+import org.apache.ivyde.eclipse.IvyPlugin;
+
+final class PreferenceValueProvider implements IValueProvider {
+ private String _name;
+
+ public PreferenceValueProvider(String name) {
+ _name = name;
+ }
+
+ public String[] getValuesfor(IvyTagAttribute att, IvyFile ivyFile) {
+ try {
+ return new String[] {IvyPlugin.getDefault().getPreferenceStore().getString(_name)};
+ } catch (Exception e) {
+ return null;
+ }
+ }
+}
Propchange: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/core/model/PreferenceValueProvider.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/core/model/Proposal.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/core/model/Proposal.java?rev=611752&r1=611751&r2=611752&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/core/model/Proposal.java (original)
+++ ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/core/model/Proposal.java Mon Jan 14 02:26:37 2008
@@ -1,35 +1,33 @@
-/*
- * This file is given under the licence found in LICENCE.TXT in the root directory of the project.
- *
- * #SNAPSHOT#
- */
-package org.apache.ivyde.eclipse.ui.core.model;
-
-public class Proposal {
- private int _cursor;
- private String _proposal;
- private String _doc;
-
- public Proposal(String proposal, int cursor, String doc) {
- _cursor = cursor;
- _proposal = proposal;
- _doc = doc;
- }
-
- public int getCursor() {
- return _cursor;
- }
-
-
- public String getProposal() {
- return _proposal;
- }
-
- public String getDoc() {
- return _doc;
- }
-
-
-
-
-}
+/*
+ * This file is given under the licence found in LICENCE.TXT in the root directory of the project.
+ *
+ * #SNAPSHOT#
+ */
+package org.apache.ivyde.eclipse.ui.core.model;
+
+public class Proposal {
+ private int _cursor;
+
+ private String _proposal;
+
+ private String _doc;
+
+ public Proposal(String proposal, int cursor, String doc) {
+ _cursor = cursor;
+ _proposal = proposal;
+ _doc = doc;
+ }
+
+ public int getCursor() {
+ return _cursor;
+ }
+
+ public String getProposal() {
+ return _proposal;
+ }
+
+ public String getDoc() {
+ return _doc;
+ }
+
+}
Propchange: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/core/model/Proposal.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/core/model/SingleValueProvider.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/core/model/SingleValueProvider.java?rev=611752&r1=611751&r2=611752&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/core/model/SingleValueProvider.java (original)
+++ ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/core/model/SingleValueProvider.java Mon Jan 14 02:26:37 2008
@@ -1,12 +1,12 @@
-/*
- * This file is given under the licence found in LICENCE.TXT in the root directory of the project.
- *
- * #SNAPSHOT#
- */
-package org.apache.ivyde.eclipse.ui.core.model;
-
-public class SingleValueProvider extends ListValueProvider {
- public SingleValueProvider(String value) {
- super(new String[] {value});
- }
-}
+/*
+ * This file is given under the licence found in LICENCE.TXT in the root directory of the project.
+ *
+ * #SNAPSHOT#
+ */
+package org.apache.ivyde.eclipse.ui.core.model;
+
+public class SingleValueProvider extends ListValueProvider {
+ public SingleValueProvider(String value) {
+ super(new String[] {value});
+ }
+}
Propchange: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/core/model/SingleValueProvider.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/core/model/defaults.properties
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/core/model/defaults.properties?rev=611752&r1=611751&r2=611752&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/core/model/defaults.properties (original)
+++ ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/core/model/defaults.properties Mon Jan 14 02:26:37 2008
@@ -1,4 +1,4 @@
-status = release, milestone, integration
-license = GPL, LGPL, BSD, CPL, Apache
-type = ivy, jar, war, ear
-ext = xml, jar, war, ear, zip
\ No newline at end of file
+status = release, milestone, integration
+license = GPL, LGPL, BSD, CPL, Apache
+type = ivy, jar, war, ear
+ext = xml, jar, war, ear, zip
Propchange: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/core/model/defaults.properties
------------------------------------------------------------------------------
svn:eol-style = native
Modified: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/IvyEditor.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/IvyEditor.java?rev=611752&r1=611751&r2=611752&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/IvyEditor.java (original)
+++ ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/IvyEditor.java Mon Jan 14 02:26:37 2008
@@ -1,178 +1,185 @@
-package org.apache.ivyde.eclipse.ui.editors;
-
-import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathContainer;
-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.XMLEditor;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceChangeEvent;
-import org.eclipse.core.resources.IResourceChangeListener;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.browser.Browser;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.forms.editor.FormEditor;
-import org.eclipse.ui.ide.IDE;
-import org.eclipse.ui.part.FileEditorInput;
-
-
-public class IvyEditor extends FormEditor implements IResourceChangeListener {
- public final static String ID = "org.apache.ivyde.editors.IvyEditor";
- private XMLEditor xmlEditor;
- private Browser _browser;
-
- /**
- * Creates a multi-page editor example.
- */
- public IvyEditor() {
- super();
- ResourcesPlugin.getWorkspace().addResourceChangeListener(this);
- }
-
- protected void setInput(IEditorInput input) {
- IvyFileEditorInput ivyFileEditorInput = null;
- if (input instanceof FileEditorInput) {
- FileEditorInput fei = (FileEditorInput) input;
- IFile file = ((FileEditorInput)input).getFile();
- ivyFileEditorInput = new IvyFileEditorInput(file);
- } else if (input instanceof IvyFileEditorInput) {
- ivyFileEditorInput = (IvyFileEditorInput) input;
- }
- super.setInput(ivyFileEditorInput);
- if (ivyFileEditorInput.getFile() != null) {
- if (xmlEditor != null) {
- xmlEditor.setFile(ivyFileEditorInput.getFile());
- }
- }
- //deprectated but we need retro compatibility
- setTitle(ivyFileEditorInput.getFile().getName());
- }
-
- void createPageXML() {
- try {
- xmlEditor = new XMLEditor();
- xmlEditor.setFile(((IvyFileEditorInput)getEditorInput()).getFile());
- int index = addPage(xmlEditor, getEditorInput());
- setPageText(index, xmlEditor.getTitle());
- } catch (PartInitException e) {
- ErrorDialog.openError(getSite().getShell(), "Error creating nested text editor", null, e.getStatus());
- }
- }
-
- void createPageOverView() {
- try {
- int index = addPage(new OverviewFormPage(this));
- setPageText(index, "Information");
- } catch (PartInitException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- }
-
- void createPagePreview() {
- _browser = new Browser(getContainer(), SWT.NONE);
- _browser.setUrl(((IvyFileEditorInput)getEditorInput()).getPath().toOSString());
- int index = addPage(_browser);
- setPageText(index, "Preview");
- }
-
- /**
- * Creates the pages of the multi-page editor.
- */
- protected void addPages() {
-// createPageOverView();
- createPageXML();
-// createPagePreview();
- }
-
- /**
- * The <code>MultiPageEditorPart</code> implementation of this <code>IWorkbenchPart</code> method disposes all nested editors. Subclasses may extend.
- */
- public void dispose() {
- ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
- super.dispose();
- }
-
- /**
- * Saves the multi-page editor's document.
- */
- public void doSave(IProgressMonitor monitor) {
- xmlEditor.doSave(monitor);
- IFile file = ((IvyFileEditorInput)getEditorInput()).getFile();
- IvyClasspathContainer.resolveIfNeeded(file);
- }
-
- /**
- * Saves the multi-page editor's document as another file. Also updates the text for page 0's tab, and updates this multi-page editor's input to correspond to the nested editor's.
- */
- public void doSaveAs() {
- xmlEditor.doSaveAs();
- setPageText(0, xmlEditor.getTitle());
- setInput(xmlEditor.getEditorInput());
- }
-
- /*
- * (non-Javadoc) Method declared on IEditorPart
- */
- public void gotoMarker(IMarker marker) {
- setActivePage(0);
- IDE.gotoMarker(getEditor(0), marker);
- }
-
- /**
- * The <code>MultiPageEditorExample</code> implementation of this method checks that the input is an instance of <code>IFileEditorInput</code>.
- */
- public void init(IEditorSite site, IEditorInput editorInput) throws PartInitException {
- if (!(editorInput instanceof IFileEditorInput))
- throw new PartInitException("Invalid Input: Must be IFileEditorInput");
- super.init(site, editorInput);
- }
-
- /*
- * (non-Javadoc) Method declared on IEditorPart.
- */
- public boolean isSaveAsAllowed() {
- return xmlEditor.isSaveAsAllowed();
- }
-
- /**
- * Calculates the contents of page 2 when the it is activated.
- */
- protected void pageChange(int newPageIndex) {
- super.pageChange(newPageIndex);
- if (newPageIndex == 1) {
- _browser.refresh();
- }
- }
-
- /**
- * Closes all project files on project close.
- */
- public void resourceChanged(IResourceChangeEvent event) {
- if (event.getType() == IResourceChangeEvent.PRE_CLOSE) {
- final IResource res = event.getResource();
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- IWorkbenchPage[] pages = getSite().getWorkbenchWindow().getPages();
- for (int i = 0; i < pages.length; i++) {
- if (((FileEditorInput) xmlEditor.getEditorInput()).getFile().getProject().equals(res)) {
- IEditorPart editorPart = pages[i].findEditor(xmlEditor.getEditorInput());
- pages[i].closeEditor(editorPart, true);
- }
- }
- }
- });
- }
- }
-}
+package org.apache.ivyde.eclipse.ui.editors;
+
+import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathContainer;
+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.XMLEditor;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IResourceChangeListener;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.browser.Browser;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.forms.editor.FormEditor;
+import org.eclipse.ui.ide.IDE;
+import org.eclipse.ui.part.FileEditorInput;
+
+public class IvyEditor extends FormEditor implements IResourceChangeListener {
+ public final static String ID = "org.apache.ivyde.editors.IvyEditor";
+
+ private XMLEditor xmlEditor;
+
+ private Browser _browser;
+
+ /**
+ * Creates a multi-page editor example.
+ */
+ public IvyEditor() {
+ super();
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(this);
+ }
+
+ protected void setInput(IEditorInput input) {
+ IvyFileEditorInput ivyFileEditorInput = null;
+ if (input instanceof FileEditorInput) {
+ FileEditorInput fei = (FileEditorInput) input;
+ IFile file = ((FileEditorInput) input).getFile();
+ ivyFileEditorInput = new IvyFileEditorInput(file);
+ } else if (input instanceof IvyFileEditorInput) {
+ ivyFileEditorInput = (IvyFileEditorInput) input;
+ }
+ super.setInput(ivyFileEditorInput);
+ if (ivyFileEditorInput.getFile() != null) {
+ if (xmlEditor != null) {
+ xmlEditor.setFile(ivyFileEditorInput.getFile());
+ }
+ }
+ // deprectated but we need retro compatibility
+ setTitle(ivyFileEditorInput.getFile().getName());
+ }
+
+ void createPageXML() {
+ try {
+ xmlEditor = new XMLEditor();
+ xmlEditor.setFile(((IvyFileEditorInput) getEditorInput()).getFile());
+ int index = addPage(xmlEditor, getEditorInput());
+ setPageText(index, xmlEditor.getTitle());
+ } catch (PartInitException e) {
+ ErrorDialog.openError(getSite().getShell(), "Error creating nested text editor", null,
+ e.getStatus());
+ }
+ }
+
+ void createPageOverView() {
+ try {
+ int index = addPage(new OverviewFormPage(this));
+ setPageText(index, "Information");
+ } catch (PartInitException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
+
+ void createPagePreview() {
+ _browser = new Browser(getContainer(), SWT.NONE);
+ _browser.setUrl(((IvyFileEditorInput) getEditorInput()).getPath().toOSString());
+ int index = addPage(_browser);
+ setPageText(index, "Preview");
+ }
+
+ /**
+ * Creates the pages of the multi-page editor.
+ */
+ protected void addPages() {
+ // createPageOverView();
+ createPageXML();
+ // createPagePreview();
+ }
+
+ /**
+ * The <code>MultiPageEditorPart</code> implementation of this <code>IWorkbenchPart</code>
+ * method disposes all nested editors. Subclasses may extend.
+ */
+ public void dispose() {
+ ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
+ super.dispose();
+ }
+
+ /**
+ * Saves the multi-page editor's document.
+ */
+ public void doSave(IProgressMonitor monitor) {
+ xmlEditor.doSave(monitor);
+ IFile file = ((IvyFileEditorInput) getEditorInput()).getFile();
+ IvyClasspathContainer.resolveIfNeeded(file);
+ }
+
+ /**
+ * Saves the multi-page editor's document as another file. Also updates the text for page 0's
+ * tab, and updates this multi-page editor's input to correspond to the nested editor's.
+ */
+ public void doSaveAs() {
+ xmlEditor.doSaveAs();
+ setPageText(0, xmlEditor.getTitle());
+ setInput(xmlEditor.getEditorInput());
+ }
+
+ /*
+ * (non-Javadoc) Method declared on IEditorPart
+ */
+ public void gotoMarker(IMarker marker) {
+ setActivePage(0);
+ IDE.gotoMarker(getEditor(0), marker);
+ }
+
+ /**
+ * The <code>MultiPageEditorExample</code> implementation of this method checks that the input
+ * is an instance of <code>IFileEditorInput</code>.
+ */
+ public void init(IEditorSite site, IEditorInput editorInput) throws PartInitException {
+ if (!(editorInput instanceof IFileEditorInput))
+ throw new PartInitException("Invalid Input: Must be IFileEditorInput");
+ super.init(site, editorInput);
+ }
+
+ /*
+ * (non-Javadoc) Method declared on IEditorPart.
+ */
+ public boolean isSaveAsAllowed() {
+ return xmlEditor.isSaveAsAllowed();
+ }
+
+ /**
+ * Calculates the contents of page 2 when the it is activated.
+ */
+ protected void pageChange(int newPageIndex) {
+ super.pageChange(newPageIndex);
+ if (newPageIndex == 1) {
+ _browser.refresh();
+ }
+ }
+
+ /**
+ * Closes all project files on project close.
+ */
+ public void resourceChanged(IResourceChangeEvent event) {
+ if (event.getType() == IResourceChangeEvent.PRE_CLOSE) {
+ final IResource res = event.getResource();
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ IWorkbenchPage[] pages = getSite().getWorkbenchWindow().getPages();
+ for (int i = 0; i < pages.length; i++) {
+ if (((FileEditorInput) xmlEditor.getEditorInput()).getFile().getProject()
+ .equals(res)) {
+ IEditorPart editorPart = pages[i]
+ .findEditor(xmlEditor.getEditorInput());
+ pages[i].closeEditor(editorPart, true);
+ }
+ }
+ }
+ });
+ }
+ }
+}
Propchange: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/IvyEditor.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/IvyEditorContributor.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/IvyEditorContributor.java?rev=611752&r1=611751&r2=611752&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/IvyEditorContributor.java (original)
+++ ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/IvyEditorContributor.java Mon Jan 14 02:26:37 2008
@@ -1,101 +1,99 @@
-package org.apache.ivyde.eclipse.ui.editors;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.ide.IDEActionFactory;
-import org.eclipse.ui.part.MultiPageEditorActionBarContributor;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.ui.texteditor.ITextEditorActionConstants;
-
-/**
- * Manages the installation/deinstallation of global actions for multi-page editors.
- * Responsible for the redirection of global actions to the active editor.
- * Multi-page contributor replaces the contributors for the individual editors in the multi-page editor.
- */
-public class IvyEditorContributor extends MultiPageEditorActionBarContributor {
- private IEditorPart activeEditorPart;
-// private Action sampleAction;
- /**
- * Creates a multi-page contributor.
- */
- public IvyEditorContributor() {
- super();
- createActions();
- }
- /**
- * Returns the action registed with the given text editor.
- * @return IAction or null if editor is null.
- */
- protected IAction getAction(ITextEditor editor, String actionID) {
- return (editor == null ? null : editor.getAction(actionID));
- }
- /* (non-JavaDoc)
- * Method declared in AbstractMultiPageEditorActionBarContributor.
- */
-
- public void setActivePage(IEditorPart part) {
- if (activeEditorPart == part)
- return;
-
- activeEditorPart = part;
-
- IActionBars actionBars = getActionBars();
- if (actionBars != null) {
-
- ITextEditor editor = (part instanceof ITextEditor) ? (ITextEditor) part : null;
-
- actionBars.setGlobalActionHandler(
- ActionFactory.DELETE.getId(),
- getAction(editor, ITextEditorActionConstants.DELETE));
- actionBars.setGlobalActionHandler(
- ActionFactory.UNDO.getId(),
- getAction(editor, ITextEditorActionConstants.UNDO));
- actionBars.setGlobalActionHandler(
- ActionFactory.REDO.getId(),
- getAction(editor, ITextEditorActionConstants.REDO));
- actionBars.setGlobalActionHandler(
- ActionFactory.CUT.getId(),
- getAction(editor, ITextEditorActionConstants.CUT));
- actionBars.setGlobalActionHandler(
- ActionFactory.COPY.getId(),
- getAction(editor, ITextEditorActionConstants.COPY));
- actionBars.setGlobalActionHandler(
- ActionFactory.PASTE.getId(),
- getAction(editor, ITextEditorActionConstants.PASTE));
- actionBars.setGlobalActionHandler(
- ActionFactory.SELECT_ALL.getId(),
- getAction(editor, ITextEditorActionConstants.SELECT_ALL));
- actionBars.setGlobalActionHandler(
- ActionFactory.FIND.getId(),
- getAction(editor, ITextEditorActionConstants.FIND));
- actionBars.setGlobalActionHandler(
- IDEActionFactory.BOOKMARK.getId(),
- getAction(editor, IDEActionFactory.BOOKMARK.getId()));
- actionBars.updateActionBars();
- }
- }
- private void createActions() {
-// sampleAction = new Action() {
-// public void run() {
-// MessageDialog.openInformation(null, "Ivy Plug-in", "Sample Action Executed");
-// }
-// };
-// sampleAction.setText("Sample Action");
-// sampleAction.setToolTipText("Sample Action tool tip");
-// sampleAction.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().
-// getImageDescriptor(IDE.SharedImages.IMG_OBJS_TASK_TSK));
- }
- public void contributeToMenu(IMenuManager manager) {
-// IMenuManager menu = new MenuManager("Editor &Menu");
-// manager.prependToGroup(IWorkbenchActionConstants.MB_ADDITIONS, menu);
-// menu.add(sampleAction);
- }
- public void contributeToToolBar(IToolBarManager manager) {
-// manager.add(new Separator());
-// manager.add(sampleAction);
- }
-}
+package org.apache.ivyde.eclipse.ui.editors;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.ide.IDEActionFactory;
+import org.eclipse.ui.part.MultiPageEditorActionBarContributor;
+import org.eclipse.ui.texteditor.ITextEditor;
+import org.eclipse.ui.texteditor.ITextEditorActionConstants;
+
+/**
+ * Manages the installation/deinstallation of global actions for multi-page editors. Responsible for
+ * the redirection of global actions to the active editor. Multi-page contributor replaces the
+ * contributors for the individual editors in the multi-page editor.
+ */
+public class IvyEditorContributor extends MultiPageEditorActionBarContributor {
+ private IEditorPart activeEditorPart;
+
+ // private Action sampleAction;
+ /**
+ * Creates a multi-page contributor.
+ */
+ public IvyEditorContributor() {
+ super();
+ createActions();
+ }
+
+ /**
+ * Returns the action registed with the given text editor.
+ *
+ * @return IAction or null if editor is null.
+ */
+ protected IAction getAction(ITextEditor editor, String actionID) {
+ return (editor == null ? null : editor.getAction(actionID));
+ }
+
+ /*
+ * (non-JavaDoc) Method declared in AbstractMultiPageEditorActionBarContributor.
+ */
+
+ public void setActivePage(IEditorPart part) {
+ if (activeEditorPart == part)
+ return;
+
+ activeEditorPart = part;
+
+ IActionBars actionBars = getActionBars();
+ if (actionBars != null) {
+
+ ITextEditor editor = (part instanceof ITextEditor) ? (ITextEditor) part : null;
+
+ actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), getAction(editor,
+ ITextEditorActionConstants.DELETE));
+ actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(), getAction(editor,
+ ITextEditorActionConstants.UNDO));
+ actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(), getAction(editor,
+ ITextEditorActionConstants.REDO));
+ actionBars.setGlobalActionHandler(ActionFactory.CUT.getId(), getAction(editor,
+ ITextEditorActionConstants.CUT));
+ actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), getAction(editor,
+ ITextEditorActionConstants.COPY));
+ actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(), getAction(editor,
+ ITextEditorActionConstants.PASTE));
+ actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), getAction(editor,
+ ITextEditorActionConstants.SELECT_ALL));
+ actionBars.setGlobalActionHandler(ActionFactory.FIND.getId(), getAction(editor,
+ ITextEditorActionConstants.FIND));
+ actionBars.setGlobalActionHandler(IDEActionFactory.BOOKMARK.getId(), getAction(editor,
+ IDEActionFactory.BOOKMARK.getId()));
+ actionBars.updateActionBars();
+ }
+ }
+
+ private void createActions() {
+ // sampleAction = new Action() {
+ // public void run() {
+ // MessageDialog.openInformation(null, "Ivy Plug-in", "Sample Action Executed");
+ // }
+ // };
+ // sampleAction.setText("Sample Action");
+ // sampleAction.setToolTipText("Sample Action tool tip");
+ // sampleAction.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().
+ // getImageDescriptor(IDE.SharedImages.IMG_OBJS_TASK_TSK));
+ }
+
+ public void contributeToMenu(IMenuManager manager) {
+ // IMenuManager menu = new MenuManager("Editor &Menu");
+ // manager.prependToGroup(IWorkbenchActionConstants.MB_ADDITIONS, menu);
+ // menu.add(sampleAction);
+ }
+
+ public void contributeToToolBar(IToolBarManager manager) {
+ // manager.add(new Separator());
+ // manager.add(sampleAction);
+ }
+}
Propchange: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/IvyEditorContributor.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/pages/IvyConfSection.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/pages/IvyConfSection.java?rev=611752&r1=611751&r2=611752&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/pages/IvyConfSection.java (original)
+++ ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/pages/IvyConfSection.java Mon Jan 14 02:26:37 2008
@@ -1,50 +1,49 @@
-package org.apache.ivyde.eclipse.ui.editors.pages;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.forms.SectionPart;
-import org.eclipse.ui.forms.editor.IFormPage;
-import org.eclipse.ui.forms.widgets.ExpandableComposite;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.Section;
-import org.eclipse.ui.forms.widgets.TableWrapData;
-import org.eclipse.ui.forms.widgets.TableWrapLayout;
-
-public class IvyConfSection extends SectionPart {
- IFormPage page;
- private static int NUM_COLUMNS = 2;
-
- public IvyConfSection(IFormPage page, Composite parent, int style, boolean titleBar) {
- super(parent, page.getManagedForm().getToolkit(), titleBar?(ExpandableComposite.TITLE_BAR | style): style);
- this.page = page;
- createClient(getSection(), page.getEditor().getToolkit());
- }
-
- protected void createClient(Section section, FormToolkit toolkit) {
- section.setText("Configurations"); //$NON-NLS-1$
- section.setDescription("This section describe the configurations defined in your project"); //$NON-NLS-1$
-
- Composite client = toolkit.createComposite(section);
- TableWrapLayout layout = new TableWrapLayout();
- layout.leftMargin = layout.rightMargin = toolkit.getBorderStyle() != SWT.NULL ? 0 : 2;
- layout.numColumns = NUM_COLUMNS;
- client.setLayout(layout);
-
-
- toolkit.paintBordersFor(client);
- section.setClient(client);
- TableWrapData td = new TableWrapData(TableWrapData.FILL_GRAB);
- td.colspan = 2;
- section.setLayoutData(td);
- }
-
-
- private void createOrganisationEntry(Composite parent, FormToolkit toolkit) {
-
-
- }
-
- public void refresh() {
- super.refresh();
- }
-}
+package org.apache.ivyde.eclipse.ui.editors.pages;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.forms.SectionPart;
+import org.eclipse.ui.forms.editor.IFormPage;
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.ui.forms.widgets.TableWrapData;
+import org.eclipse.ui.forms.widgets.TableWrapLayout;
+
+public class IvyConfSection extends SectionPart {
+ IFormPage page;
+
+ private static int NUM_COLUMNS = 2;
+
+ public IvyConfSection(IFormPage page, Composite parent, int style, boolean titleBar) {
+ super(parent, page.getManagedForm().getToolkit(),
+ titleBar ? (ExpandableComposite.TITLE_BAR | style) : style);
+ this.page = page;
+ createClient(getSection(), page.getEditor().getToolkit());
+ }
+
+ protected void createClient(Section section, FormToolkit toolkit) {
+ section.setText("Configurations"); //$NON-NLS-1$
+ section.setDescription("This section describe the configurations defined in your project"); //$NON-NLS-1$
+
+ Composite client = toolkit.createComposite(section);
+ TableWrapLayout layout = new TableWrapLayout();
+ layout.leftMargin = layout.rightMargin = toolkit.getBorderStyle() != SWT.NULL ? 0 : 2;
+ layout.numColumns = NUM_COLUMNS;
+ client.setLayout(layout);
+
+ toolkit.paintBordersFor(client);
+ section.setClient(client);
+ TableWrapData td = new TableWrapData(TableWrapData.FILL_GRAB);
+ td.colspan = 2;
+ section.setLayoutData(td);
+ }
+
+ private void createOrganisationEntry(Composite parent, FormToolkit toolkit) {
+
+ }
+
+ public void refresh() {
+ super.refresh();
+ }
+}
Propchange: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/pages/IvyConfSection.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/pages/IvyInfoSection.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/pages/IvyInfoSection.java?rev=611752&r1=611751&r2=611752&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/pages/IvyInfoSection.java (original)
+++ ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/pages/IvyInfoSection.java Mon Jan 14 02:26:37 2008
@@ -1,82 +1,82 @@
-package org.apache.ivyde.eclipse.ui.editors.pages;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-
-import org.apache.ivyde.eclipse.ui.core.IvyFileEditorInput;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.forms.SectionPart;
-import org.eclipse.ui.forms.editor.IFormPage;
-import org.eclipse.ui.forms.widgets.ExpandableComposite;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.Section;
-import org.eclipse.ui.forms.widgets.TableWrapData;
-import org.eclipse.ui.forms.widgets.TableWrapLayout;
-
-
-public class IvyInfoSection extends SectionPart implements PropertyChangeListener {
- IFormPage page;
- private static int NUM_COLUMNS = 2;
-
- public IvyInfoSection(IFormPage page, Composite parent, int style, boolean titleBar) {
- super(parent, page.getManagedForm().getToolkit(), titleBar?(ExpandableComposite.TITLE_BAR | style): style);
- this.page = page;
- createClient(getSection(), page.getEditor().getToolkit());
- getSection().setText("General Information");
-// ((IvyFileEditorInput)page.getEditorInput()).addPropertyChangeListener(this);
- }
-
- protected void createClient(Section section, FormToolkit toolkit) {
- section.setText("General Information"); //$NON-NLS-1$
- section.setDescription("This section describe the general information about your project"); //$NON-NLS-1$
-
- Composite client = toolkit.createComposite(section);
- TableWrapLayout layout = new TableWrapLayout();
- layout.leftMargin = layout.rightMargin = toolkit.getBorderStyle() != SWT.NULL ? 0 : 2;
- layout.numColumns = 2;
- client.setLayout(layout);
- IvyFileEditorInput editorInput = (IvyFileEditorInput) page.getEditorInput();
-// PresentationModel moduleModel = editorInput.getPresentationModel();
-// PresentationModel revisionModel = new PresentationModel(moduleModel.getModel("resolvedModuleRevisionId"));
-// PresentationModel moduleIdModel = new PresentationModel(moduleModel.getModel("moduleId"));
-
- toolkit.createLabel(client, "Organisation");
- Text org = toolkit.createText(client, "");
- org.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
-
-
-// SWTBindings.bind(org, moduleIdModel.getModel("organisation"), true);
-
- toolkit.createLabel(client, "Module");
- Text mod = toolkit.createText(client, "");
- mod.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
-// SWTBindings.bind(org, moduleIdModel.getModel("name"), true);
-
- toolkit.createLabel(client, "Status");
- Text status = toolkit.createText(client, "");
- status.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
-// SWTBindings.bind(org, moduleModel.getModel("status"), true);
-
- toolkit.paintBordersFor(client);
- section.setClient(client);
- TableWrapData td = new TableWrapData(TableWrapData.FILL_GRAB);
- td.colspan = 2;
- section.setLayoutData(td);
- }
-
-
- private void createOrganisationEntry(Composite parent, FormToolkit toolkit) {
-
-
- }
-
- public void refresh() {
- super.refresh();
- }
-
- public void propertyChange(PropertyChangeEvent evt) {
-
- }
-}
+package org.apache.ivyde.eclipse.ui.editors.pages;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import org.apache.ivyde.eclipse.ui.core.IvyFileEditorInput;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.forms.SectionPart;
+import org.eclipse.ui.forms.editor.IFormPage;
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.ui.forms.widgets.TableWrapData;
+import org.eclipse.ui.forms.widgets.TableWrapLayout;
+
+public class IvyInfoSection extends SectionPart implements PropertyChangeListener {
+ IFormPage page;
+
+ private static int NUM_COLUMNS = 2;
+
+ public IvyInfoSection(IFormPage page, Composite parent, int style, boolean titleBar) {
+ super(parent, page.getManagedForm().getToolkit(),
+ titleBar ? (ExpandableComposite.TITLE_BAR | style) : style);
+ this.page = page;
+ createClient(getSection(), page.getEditor().getToolkit());
+ getSection().setText("General Information");
+ // ((IvyFileEditorInput)page.getEditorInput()).addPropertyChangeListener(this);
+ }
+
+ protected void createClient(Section section, FormToolkit toolkit) {
+ section.setText("General Information"); //$NON-NLS-1$
+ section.setDescription("This section describe the general information about your project"); //$NON-NLS-1$
+
+ Composite client = toolkit.createComposite(section);
+ TableWrapLayout layout = new TableWrapLayout();
+ layout.leftMargin = layout.rightMargin = toolkit.getBorderStyle() != SWT.NULL ? 0 : 2;
+ layout.numColumns = 2;
+ client.setLayout(layout);
+ IvyFileEditorInput editorInput = (IvyFileEditorInput) page.getEditorInput();
+ // PresentationModel moduleModel = editorInput.getPresentationModel();
+ // PresentationModel revisionModel = new
+ // PresentationModel(moduleModel.getModel("resolvedModuleRevisionId"));
+ // PresentationModel moduleIdModel = new
+ // PresentationModel(moduleModel.getModel("moduleId"));
+
+ toolkit.createLabel(client, "Organisation");
+ Text org = toolkit.createText(client, "");
+ org.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
+
+ // SWTBindings.bind(org, moduleIdModel.getModel("organisation"), true);
+
+ toolkit.createLabel(client, "Module");
+ Text mod = toolkit.createText(client, "");
+ mod.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
+ // SWTBindings.bind(org, moduleIdModel.getModel("name"), true);
+
+ toolkit.createLabel(client, "Status");
+ Text status = toolkit.createText(client, "");
+ status.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
+ // SWTBindings.bind(org, moduleModel.getModel("status"), true);
+
+ toolkit.paintBordersFor(client);
+ section.setClient(client);
+ TableWrapData td = new TableWrapData(TableWrapData.FILL_GRAB);
+ td.colspan = 2;
+ section.setLayoutData(td);
+ }
+
+ private void createOrganisationEntry(Composite parent, FormToolkit toolkit) {
+
+ }
+
+ public void refresh() {
+ super.refresh();
+ }
+
+ public void propertyChange(PropertyChangeEvent evt) {
+
+ }
+}
Propchange: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/pages/IvyInfoSection.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/pages/OverviewFormPage.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/pages/OverviewFormPage.java?rev=611752&r1=611751&r2=611752&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/pages/OverviewFormPage.java (original)
+++ ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/pages/OverviewFormPage.java Mon Jan 14 02:26:37 2008
@@ -1,49 +1,49 @@
-package org.apache.ivyde.eclipse.ui.editors.pages;
-
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.forms.IManagedForm;
-import org.eclipse.ui.forms.editor.FormEditor;
-import org.eclipse.ui.forms.editor.FormPage;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.ScrolledForm;
-import org.eclipse.ui.forms.widgets.Section;
-import org.eclipse.ui.forms.widgets.TableWrapLayout;
-
-public class OverviewFormPage extends FormPage {
-
- /**
- * @param editor
- * @param id
- * @param title
- */
- public OverviewFormPage(FormEditor editor) {
- super(editor, "overview", "Overview");
- }
-
- protected void createFormContent(IManagedForm managedForm) {
- super.createFormContent(managedForm);
- ScrolledForm form = managedForm.getForm();
- FormToolkit toolkit = managedForm.getToolkit();
- form.setText("Overview");
- fillBody(managedForm, toolkit);
- managedForm.refresh();
- }
-
- private void fillBody(IManagedForm managedForm, FormToolkit toolkit) {
- Composite body = managedForm.getForm().getBody();
- TableWrapLayout layout = new TableWrapLayout();
- layout.bottomMargin = 10;
- layout.topMargin = 5;
- layout.leftMargin = 10;
- layout.rightMargin = 10;
- layout.numColumns = 2;
- layout.makeColumnsEqualWidth =true;
- layout.verticalSpacing = 30;
- layout.horizontalSpacing = 10;
- body.setLayout(layout);
-
- // sections
- managedForm.addPart(new IvyInfoSection(this, body, Section.TWISTIE, true));
- managedForm.addPart(new IvyConfSection(this, body, Section.TWISTIE, true));
- }
-}
+package org.apache.ivyde.eclipse.ui.editors.pages;
+
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.forms.IManagedForm;
+import org.eclipse.ui.forms.editor.FormEditor;
+import org.eclipse.ui.forms.editor.FormPage;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.ui.forms.widgets.TableWrapLayout;
+
+public class OverviewFormPage extends FormPage {
+
+ /**
+ * @param editor
+ * @param id
+ * @param title
+ */
+ public OverviewFormPage(FormEditor editor) {
+ super(editor, "overview", "Overview");
+ }
+
+ protected void createFormContent(IManagedForm managedForm) {
+ super.createFormContent(managedForm);
+ ScrolledForm form = managedForm.getForm();
+ FormToolkit toolkit = managedForm.getToolkit();
+ form.setText("Overview");
+ fillBody(managedForm, toolkit);
+ managedForm.refresh();
+ }
+
+ private void fillBody(IManagedForm managedForm, FormToolkit toolkit) {
+ Composite body = managedForm.getForm().getBody();
+ TableWrapLayout layout = new TableWrapLayout();
+ layout.bottomMargin = 10;
+ layout.topMargin = 5;
+ layout.leftMargin = 10;
+ layout.rightMargin = 10;
+ layout.numColumns = 2;
+ layout.makeColumnsEqualWidth = true;
+ layout.verticalSpacing = 30;
+ layout.horizontalSpacing = 10;
+ body.setLayout(layout);
+
+ // sections
+ managedForm.addPart(new IvyInfoSection(this, body, Section.TWISTIE, true));
+ managedForm.addPart(new IvyConfSection(this, body, Section.TWISTIE, true));
+ }
+}
Propchange: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/pages/OverviewFormPage.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/ColorManager.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/ColorManager.java?rev=611752&r1=611751&r2=611752&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/ColorManager.java (original)
+++ ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/ColorManager.java Mon Jan 14 02:26:37 2008
@@ -1,28 +1,29 @@
-package org.apache.ivyde.eclipse.ui.editors.xml;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.widgets.Display;
-
-public class ColorManager {
-
- protected Map fColorTable = new HashMap(10);
-
- public void dispose() {
- Iterator e = fColorTable.values().iterator();
- while (e.hasNext())
- ((Color) e.next()).dispose();
- }
- public Color getColor(RGB rgb) {
- Color color = (Color) fColorTable.get(rgb);
- if (color == null) {
- color = new Color(Display.getCurrent(), rgb);
- fColorTable.put(rgb, color);
- }
- return color;
- }
-}
+package org.apache.ivyde.eclipse.ui.editors.xml;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.widgets.Display;
+
+public class ColorManager {
+
+ protected Map fColorTable = new HashMap(10);
+
+ public void dispose() {
+ Iterator e = fColorTable.values().iterator();
+ while (e.hasNext())
+ ((Color) e.next()).dispose();
+ }
+
+ public Color getColor(RGB rgb) {
+ Color color = (Color) fColorTable.get(rgb);
+ if (color == null) {
+ color = new Color(Display.getCurrent(), rgb);
+ fColorTable.put(rgb, color);
+ }
+ return color;
+ }
+}
Propchange: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/ColorManager.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/IXMLColorConstants.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/IXMLColorConstants.java?rev=611752&r1=611751&r2=611752&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/IXMLColorConstants.java (original)
+++ ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/IXMLColorConstants.java Mon Jan 14 02:26:37 2008
@@ -1,11 +1,15 @@
-package org.apache.ivyde.eclipse.ui.editors.xml;
-
-import org.eclipse.swt.graphics.RGB;
-
-public interface IXMLColorConstants {
- RGB XML_COMMENT = new RGB(128, 0, 0);
- RGB PROC_INSTR = new RGB(128, 128, 128);
- RGB STRING = new RGB(0, 128, 0);
- RGB DEFAULT = new RGB(0, 0, 0);
- RGB TAG = new RGB(0, 0, 128);
-}
+package org.apache.ivyde.eclipse.ui.editors.xml;
+
+import org.eclipse.swt.graphics.RGB;
+
+public interface IXMLColorConstants {
+ RGB XML_COMMENT = new RGB(128, 0, 0);
+
+ RGB PROC_INSTR = new RGB(128, 128, 128);
+
+ RGB STRING = new RGB(0, 128, 0);
+
+ RGB DEFAULT = new RGB(0, 0, 0);
+
+ RGB TAG = new RGB(0, 0, 128);
+}
Propchange: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/IXMLColorConstants.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/IvyContentAssistProcessor.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/IvyContentAssistProcessor.java?rev=611752&r1=611751&r2=611752&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/IvyContentAssistProcessor.java (original)
+++ ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/IvyContentAssistProcessor.java Mon Jan 14 02:26:37 2008
@@ -1,235 +1,258 @@
-package org.apache.ivyde.eclipse.ui.editors.xml;
-
-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.eclipse.ui.core.model.IvyFile;
-import org.apache.ivyde.eclipse.ui.core.model.IvyModel;
-import org.apache.ivyde.eclipse.ui.core.model.IvyTag;
-import org.apache.ivyde.eclipse.ui.core.model.IvyTagAttribute;
-import org.apache.ivyde.eclipse.ui.core.model.Proposal;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.contentassist.CompletionProposal;
-import org.eclipse.jface.text.contentassist.ContextInformationValidator;
-import org.eclipse.jface.text.contentassist.ICompletionProposal;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.text.contentassist.IContextInformation;
-import org.eclipse.jface.text.contentassist.IContextInformationValidator;
-import org.eclipse.swt.graphics.Point;
-
-
-public class IvyContentAssistProcessor implements IContentAssistProcessor {
- private IContextInformationValidator fValidator = new ContextInformationValidator(this);
-
- private String errorMessage = null;
-
- private IFile file;
-
- private IvyModel _model;
-
- /**
- * Call by viewer to retreive a list of ICompletionProposal
- */
- public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int documentOffset) {
- // Retrieve current document
- IDocument doc = viewer.getDocument();
- // Retrieve current selection range
- Point selectedRange = viewer.getSelectedRange();
- List propList = new ArrayList();
- String ivyFileString;
- try {
- ivyFileString = doc.get(0, doc.getLength());
- } catch (BadLocationException e) {
- e.printStackTrace();
- return null;
- }
- IProject project = getProject();
- IvyFile ivyfile = new IvyFile(project != null ? project.getName() : "", ivyFileString, documentOffset);
- if (ivyfile.inTag()) {
- String tagName = ivyfile.getTagName();
- if (ivyfile.readyForValue()) {
- computeValueProposals(tagName, ivyfile, propList, selectedRange);
- } else {
- // found a value to put in tag
- computeTagAttributeProposals(tagName, ivyfile, propList, selectedRange);
- }
- } else { // not in an xml tag
- computeStructureProposals(ivyfile, propList, selectedRange);
- }
- // Create completion proposal array
- ICompletionProposal[] proposals = new ICompletionProposal[propList.size()];
-
- // and fill with list elements
- propList.toArray(proposals);
-
- // Return the proposals
- return proposals;
- }
- /**
- * 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, Point selectedRange) {
- String qualifier = ivyfile.getQualifier();
- int qlen = qualifier.length();
- if(qualifier.indexOf('/') >-1) {
- String text = "/>";
- CompletionProposal proposal = new CompletionProposal(text, ivyfile.getOffset() - qlen , qlen+selectedRange.y, 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
- CompletionProposal proposal = new CompletionProposal(text, ivyfile.getOffset() - qlen , qlen+selectedRange.y, text.length()-1, null, att.getName(), null, 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, Point selection) {
- 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];
- CompletionProposal proposal = new CompletionProposal(val, ivyfile.getOffset() - qlen, qlen+selection.y, val.length());
- propList.add(proposal);
- }
- }
- }
- }
- /**
- * Compute xml structural proposition
- */
- private void computeStructureProposals(IvyFile ivyfile, List propList, Point selectedRange) {
- 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+">";
- CompletionProposal proposal = new CompletionProposal(text, ivyfile.getOffset() - qlen -2 , qlen+2+selectedRange.y, 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
- CompletionProposal proposal = new CompletionProposal(text, ivyfile.getOffset(), selectedRange.y, 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 CompletionProposal(props[i].getProposal(), ivyfile.getOffset() - qlen, qlen + selectedRange.y, props[i].getCursor(), null, null, null, props[i].getDoc()));
- }
- }
- }
- }
- }
-
- public IContextInformation[] computeContextInformation(ITextViewer viewer, int offset) {
- return null;
- }
-
- public char[] getCompletionProposalAutoActivationCharacters() {
- return new char[] { '<', '"' };
- }
-
- public char[] getContextInformationAutoActivationCharacters() {
- return null;
- }
-
- public String getErrorMessage() {
- return errorMessage;
- }
-
- public IContextInformationValidator getContextInformationValidator() {
- return fValidator;
- }
- public IJavaProject getJavaProject() {
- IProject p = getProject();
- return JavaCore.create(p);
- }
- public IProject getProject() {
- return file == null ? null :file.getProject();
- }
-
- public void setFile(IFile file) {
- this.file = file;
- _model = new IvyModel(getJavaProject());
- }
-
-}
\ No newline at end of file
+package org.apache.ivyde.eclipse.ui.editors.xml;
+
+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.eclipse.ui.core.model.IvyFile;
+import org.apache.ivyde.eclipse.ui.core.model.IvyModel;
+import org.apache.ivyde.eclipse.ui.core.model.IvyTag;
+import org.apache.ivyde.eclipse.ui.core.model.IvyTagAttribute;
+import org.apache.ivyde.eclipse.ui.core.model.Proposal;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.contentassist.CompletionProposal;
+import org.eclipse.jface.text.contentassist.ContextInformationValidator;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.text.contentassist.IContextInformation;
+import org.eclipse.jface.text.contentassist.IContextInformationValidator;
+import org.eclipse.swt.graphics.Point;
+
+public class IvyContentAssistProcessor implements IContentAssistProcessor {
+ private IContextInformationValidator fValidator = new ContextInformationValidator(this);
+
+ private String errorMessage = null;
+
+ private IFile file;
+
+ private IvyModel _model;
+
+ /**
+ * Call by viewer to retreive a list of ICompletionProposal
+ */
+ public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int documentOffset) {
+ // Retrieve current document
+ IDocument doc = viewer.getDocument();
+ // Retrieve current selection range
+ Point selectedRange = viewer.getSelectedRange();
+ List propList = new ArrayList();
+ String ivyFileString;
+ try {
+ ivyFileString = doc.get(0, doc.getLength());
+ } catch (BadLocationException e) {
+ e.printStackTrace();
+ return null;
+ }
+ IProject project = getProject();
+ IvyFile ivyfile = new IvyFile(project != null ? project.getName() : "", ivyFileString,
+ documentOffset);
+ if (ivyfile.inTag()) {
+ String tagName = ivyfile.getTagName();
+ if (ivyfile.readyForValue()) {
+ computeValueProposals(tagName, ivyfile, propList, selectedRange);
+ } else {
+ // found a value to put in tag
+ computeTagAttributeProposals(tagName, ivyfile, propList, selectedRange);
+ }
+ } else { // not in an xml tag
+ computeStructureProposals(ivyfile, propList, selectedRange);
+ }
+ // Create completion proposal array
+ ICompletionProposal[] proposals = new ICompletionProposal[propList.size()];
+
+ // and fill with list elements
+ propList.toArray(proposals);
+
+ // Return the proposals
+ return proposals;
+ }
+
+ /**
+ * 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,
+ Point selectedRange) {
+ String qualifier = ivyfile.getQualifier();
+ int qlen = qualifier.length();
+ if (qualifier.indexOf('/') > -1) {
+ String text = "/>";
+ CompletionProposal proposal = new CompletionProposal(text, ivyfile.getOffset() - qlen,
+ qlen + selectedRange.y, 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
+ CompletionProposal proposal = new CompletionProposal(text, ivyfile.getOffset()
+ - qlen, qlen + selectedRange.y, text.length() - 1, null, att.getName(),
+ null, 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,
+ Point selection) {
+ 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];
+ CompletionProposal proposal = new CompletionProposal(val, ivyfile.getOffset()
+ - qlen, qlen + selection.y, val.length());
+ propList.add(proposal);
+ }
+ }
+ }
+ }
+
+ /**
+ * Compute xml structural proposition
+ */
+ private void computeStructureProposals(IvyFile ivyfile, List propList, Point selectedRange) {
+ 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 + ">";
+ CompletionProposal proposal = new CompletionProposal(text, ivyfile.getOffset() - qlen
+ - 2, qlen + 2 + selectedRange.y, 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
+ CompletionProposal proposal = new CompletionProposal(text, ivyfile.getOffset(),
+ selectedRange.y, 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 CompletionProposal(props[i].getProposal(), ivyfile
+ .getOffset()
+ - qlen, qlen + selectedRange.y, props[i].getCursor(), null, null,
+ null, props[i].getDoc()));
+ }
+ }
+ }
+ }
+ }
+
+ public IContextInformation[] computeContextInformation(ITextViewer viewer, int offset) {
+ return null;
+ }
+
+ public char[] getCompletionProposalAutoActivationCharacters() {
+ return new char[] {'<', '"'};
+ }
+
+ public char[] getContextInformationAutoActivationCharacters() {
+ return null;
+ }
+
+ public String getErrorMessage() {
+ return errorMessage;
+ }
+
+ public IContextInformationValidator getContextInformationValidator() {
+ return fValidator;
+ }
+
+ public IJavaProject getJavaProject() {
+ IProject p = getProject();
+ return JavaCore.create(p);
+ }
+
+ public IProject getProject() {
+ return file == null ? null : file.getProject();
+ }
+
+ public void setFile(IFile file) {
+ this.file = file;
+ _model = new IvyModel(getJavaProject());
+ }
+
+}
Propchange: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/IvyContentAssistProcessor.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/NonRuleBasedDamagerRepairer.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/NonRuleBasedDamagerRepairer.java?rev=611752&r1=611751&r2=611752&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/NonRuleBasedDamagerRepairer.java (original)
+++ ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/NonRuleBasedDamagerRepairer.java Mon Jan 14 02:26:37 2008
@@ -1,138 +1,120 @@
-package org.apache.ivyde.eclipse.ui.editors.xml;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.DocumentEvent;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITypedRegion;
-import org.eclipse.jface.text.Region;
-import org.eclipse.jface.text.TextAttribute;
-import org.eclipse.jface.text.TextPresentation;
-import org.eclipse.jface.text.presentation.IPresentationDamager;
-import org.eclipse.jface.text.presentation.IPresentationRepairer;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.swt.custom.StyleRange;
-
-public class NonRuleBasedDamagerRepairer
- implements IPresentationDamager, IPresentationRepairer {
-
- /** The document this object works on */
- protected IDocument fDocument;
- /** The default text attribute if non is returned as data by the current token */
- protected TextAttribute fDefaultTextAttribute;
-
- /**
- * Constructor for NonRuleBasedDamagerRepairer.
- */
- public NonRuleBasedDamagerRepairer(TextAttribute defaultTextAttribute) {
- Assert.isNotNull(defaultTextAttribute);
-
- fDefaultTextAttribute = defaultTextAttribute;
- }
-
- /**
- * @see IPresentationRepairer#setDocument(IDocument)
- */
- public void setDocument(IDocument document) {
- fDocument = document;
- }
-
- /**
- * Returns the end offset of the line that contains the specified offset or
- * if the offset is inside a line delimiter, the end offset of the next line.
- *
- * @param offset the offset whose line end offset must be computed
- * @return the line end offset for the given offset
- * @exception BadLocationException if offset is invalid in the current document
- */
- protected int endOfLineOf(int offset) throws BadLocationException {
-
- IRegion info = fDocument.getLineInformationOfOffset(offset);
- if (offset <= info.getOffset() + info.getLength())
- return info.getOffset() + info.getLength();
-
- int line = fDocument.getLineOfOffset(offset);
- try {
- info = fDocument.getLineInformation(line + 1);
- return info.getOffset() + info.getLength();
- } catch (BadLocationException x) {
- return fDocument.getLength();
- }
- }
-
- /**
- * @see IPresentationDamager#getDamageRegion(ITypedRegion, DocumentEvent, boolean)
- */
- public IRegion getDamageRegion(
- ITypedRegion partition,
- DocumentEvent event,
- boolean documentPartitioningChanged) {
- if (!documentPartitioningChanged) {
- try {
-
- IRegion info =
- fDocument.getLineInformationOfOffset(event.getOffset());
- int start = Math.max(partition.getOffset(), info.getOffset());
-
- int end =
- event.getOffset()
- + (event.getText() == null
- ? event.getLength()
- : event.getText().length());
-
- if (info.getOffset() <= end
- && end <= info.getOffset() + info.getLength()) {
- // optimize the case of the same line
- end = info.getOffset() + info.getLength();
- } else
- end = endOfLineOf(end);
-
- end =
- Math.min(
- partition.getOffset() + partition.getLength(),
- end);
- return new Region(start, end - start);
-
- } catch (BadLocationException x) {
- }
- }
-
- return partition;
- }
-
- /**
- * @see IPresentationRepairer#createPresentation(TextPresentation, ITypedRegion)
- */
- public void createPresentation(
- TextPresentation presentation,
- ITypedRegion region) {
- addRange(
- presentation,
- region.getOffset(),
- region.getLength(),
- fDefaultTextAttribute);
- }
-
- /**
- * Adds style information to the given text presentation.
- *
- * @param presentation the text presentation to be extended
- * @param offset the offset of the range to be styled
- * @param length the length of the range to be styled
- * @param attr the attribute describing the style of the range to be styled
- */
- protected void addRange(
- TextPresentation presentation,
- int offset,
- int length,
- TextAttribute attr) {
- if (attr != null)
- presentation.addStyleRange(
- new StyleRange(
- offset,
- length,
- attr.getForeground(),
- attr.getBackground(),
- attr.getStyle()));
- }
-}
\ No newline at end of file
+package org.apache.ivyde.eclipse.ui.editors.xml;
+
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.DocumentEvent;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.ITypedRegion;
+import org.eclipse.jface.text.Region;
+import org.eclipse.jface.text.TextAttribute;
+import org.eclipse.jface.text.TextPresentation;
+import org.eclipse.jface.text.presentation.IPresentationDamager;
+import org.eclipse.jface.text.presentation.IPresentationRepairer;
+import org.eclipse.jface.util.Assert;
+import org.eclipse.swt.custom.StyleRange;
+
+public class NonRuleBasedDamagerRepairer implements IPresentationDamager, IPresentationRepairer {
+
+ /** The document this object works on */
+ protected IDocument fDocument;
+
+ /** The default text attribute if non is returned as data by the current token */
+ protected TextAttribute fDefaultTextAttribute;
+
+ /**
+ * Constructor for NonRuleBasedDamagerRepairer.
+ */
+ public NonRuleBasedDamagerRepairer(TextAttribute defaultTextAttribute) {
+ Assert.isNotNull(defaultTextAttribute);
+
+ fDefaultTextAttribute = defaultTextAttribute;
+ }
+
+ /**
+ * @see IPresentationRepairer#setDocument(IDocument)
+ */
+ public void setDocument(IDocument document) {
+ fDocument = document;
+ }
+
+ /**
+ * Returns the end offset of the line that contains the specified offset or if the offset is
+ * inside a line delimiter, the end offset of the next line.
+ *
+ * @param offset
+ * the offset whose line end offset must be computed
+ * @return the line end offset for the given offset
+ * @exception BadLocationException
+ * if offset is invalid in the current document
+ */
+ protected int endOfLineOf(int offset) throws BadLocationException {
+
+ IRegion info = fDocument.getLineInformationOfOffset(offset);
+ if (offset <= info.getOffset() + info.getLength())
+ return info.getOffset() + info.getLength();
+
+ int line = fDocument.getLineOfOffset(offset);
+ try {
+ info = fDocument.getLineInformation(line + 1);
+ return info.getOffset() + info.getLength();
+ } catch (BadLocationException x) {
+ return fDocument.getLength();
+ }
+ }
+
+ /**
+ * @see IPresentationDamager#getDamageRegion(ITypedRegion, DocumentEvent, boolean)
+ */
+ public IRegion getDamageRegion(ITypedRegion partition, DocumentEvent event,
+ boolean documentPartitioningChanged) {
+ if (!documentPartitioningChanged) {
+ try {
+
+ IRegion info = fDocument.getLineInformationOfOffset(event.getOffset());
+ int start = Math.max(partition.getOffset(), info.getOffset());
+
+ int end = event.getOffset()
+ + (event.getText() == null ? event.getLength() : event.getText().length());
+
+ if (info.getOffset() <= end && end <= info.getOffset() + info.getLength()) {
+ // optimize the case of the same line
+ end = info.getOffset() + info.getLength();
+ } else
+ end = endOfLineOf(end);
+
+ end = Math.min(partition.getOffset() + partition.getLength(), end);
+ return new Region(start, end - start);
+
+ } catch (BadLocationException x) {
+ }
+ }
+
+ return partition;
+ }
+
+ /**
+ * @see IPresentationRepairer#createPresentation(TextPresentation, ITypedRegion)
+ */
+ public void createPresentation(TextPresentation presentation, ITypedRegion region) {
+ addRange(presentation, region.getOffset(), region.getLength(), fDefaultTextAttribute);
+ }
+
+ /**
+ * Adds style information to the given text presentation.
+ *
+ * @param presentation
+ * the text presentation to be extended
+ * @param offset
+ * the offset of the range to be styled
+ * @param length
+ * the length of the range to be styled
+ * @param attr
+ * the attribute describing the style of the range to be styled
+ */
+ protected void addRange(TextPresentation presentation, int offset, int length,
+ TextAttribute attr) {
+ if (attr != null)
+ presentation.addStyleRange(new StyleRange(offset, length, attr.getForeground(), attr
+ .getBackground(), attr.getStyle()));
+ }
+}
Propchange: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/NonRuleBasedDamagerRepairer.java
------------------------------------------------------------------------------
svn:eol-style = native