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 [9/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/editors/xml/TagRule.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/TagRule.java?rev=611752&r1=611751&r2=611752&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/TagRule.java (original)
+++ ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/TagRule.java Mon Jan 14 02:26:37 2008
@@ -1,34 +1,36 @@
-package org.apache.ivyde.eclipse.ui.editors.xml;
-
-import org.eclipse.jface.text.rules.*;
-
-public class TagRule extends MultiLineRule {
-
- public TagRule(IToken token) {
- super("<", ">", token, '-');
- }
- protected boolean sequenceDetected(
- ICharacterScanner scanner,
- char[] sequence,
- boolean eofAllowed) {
- int c = scanner.read();
- if (sequence[0] == '<') {
- if (c == '?') {
- // processing instruction - abort
- scanner.unread();
- return false;
- }
- if (c == '!') {
- scanner.unread();
- // comment - abort
- return false;
- }
- } else if (sequence[0] == '>') {
- scanner.unread();
- }
- return super.sequenceDetected(scanner, sequence, eofAllowed);
- }
- protected boolean endSequenceDetected(ICharacterScanner scanner) {
- return super.endSequenceDetected(scanner);
- }
-}
+package org.apache.ivyde.eclipse.ui.editors.xml;
+
+import org.eclipse.jface.text.rules.ICharacterScanner;
+import org.eclipse.jface.text.rules.IToken;
+import org.eclipse.jface.text.rules.MultiLineRule;
+
+public class TagRule extends MultiLineRule {
+
+ public TagRule(IToken token) {
+ super("<", ">", token, '-');
+ }
+
+ protected boolean sequenceDetected(ICharacterScanner scanner, char[] sequence,
+ boolean eofAllowed) {
+ int c = scanner.read();
+ if (sequence[0] == '<') {
+ if (c == '?') {
+ // processing instruction - abort
+ scanner.unread();
+ return false;
+ }
+ if (c == '!') {
+ scanner.unread();
+ // comment - abort
+ return false;
+ }
+ } else if (sequence[0] == '>') {
+ scanner.unread();
+ }
+ return super.sequenceDetected(scanner, sequence, eofAllowed);
+ }
+
+ protected boolean endSequenceDetected(ICharacterScanner scanner) {
+ return super.endSequenceDetected(scanner);
+ }
+}
Propchange: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/TagRule.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLConfiguration.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLConfiguration.java?rev=611752&r1=611751&r2=611752&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLConfiguration.java (original)
+++ ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLConfiguration.java Mon Jan 14 02:26:37 2008
@@ -1,119 +1,117 @@
-package org.apache.ivyde.eclipse.ui.editors.xml;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jface.text.DefaultInformationControl;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IInformationControl;
-import org.eclipse.jface.text.IInformationControlCreator;
-import org.eclipse.jface.text.ITextDoubleClickStrategy;
-import org.eclipse.jface.text.TextAttribute;
-import org.eclipse.jface.text.contentassist.ContentAssistant;
-import org.eclipse.jface.text.contentassist.IContentAssistant;
-import org.eclipse.jface.text.presentation.IPresentationReconciler;
-import org.eclipse.jface.text.presentation.PresentationReconciler;
-import org.eclipse.jface.text.rules.DefaultDamagerRepairer;
-import org.eclipse.jface.text.rules.Token;
-import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.jface.text.source.SourceViewerConfiguration;
-import org.eclipse.swt.widgets.Shell;
-
-
-public class XMLConfiguration extends SourceViewerConfiguration {
- private XMLDoubleClickStrategy doubleClickStrategy;
- private XMLTagScanner tagScanner;
- private XMLScanner scanner;
- private ColorManager colorManager;
- private IProject project;
- private IvyContentAssistProcessor _processor;
- private IFile _file;
-
- public XMLConfiguration(ColorManager colorManager) {
- this.colorManager = colorManager;
- }
- public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
- return new String[] {
- IDocument.DEFAULT_CONTENT_TYPE,
- XMLPartitionScanner.XML_COMMENT,
- XMLPartitionScanner.XML_TAG };
- }
- public ITextDoubleClickStrategy getDoubleClickStrategy(
- ISourceViewer sourceViewer,
- String contentType) {
- if (doubleClickStrategy == null)
- doubleClickStrategy = new XMLDoubleClickStrategy();
- return doubleClickStrategy;
- }
-
- protected XMLScanner getXMLScanner() {
- if (scanner == null) {
- scanner = new XMLScanner(colorManager);
- scanner.setDefaultReturnToken(
- new Token(
- new TextAttribute(
- colorManager.getColor(IXMLColorConstants.DEFAULT))));
- }
- return scanner;
- }
- protected XMLTagScanner getXMLTagScanner() {
- if (tagScanner == null) {
- tagScanner = new XMLTagScanner(colorManager);
- tagScanner.setDefaultReturnToken(
- new Token(
- new TextAttribute(
- colorManager.getColor(IXMLColorConstants.TAG))));
- }
- return tagScanner;
- }
-
- public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
- PresentationReconciler reconciler = new PresentationReconciler();
-
- DefaultDamagerRepairer dr =
- new DefaultDamagerRepairer(getXMLTagScanner());
- reconciler.setDamager(dr, XMLPartitionScanner.XML_TAG);
- reconciler.setRepairer(dr, XMLPartitionScanner.XML_TAG);
-
- dr = new DefaultDamagerRepairer(getXMLScanner());
- reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
- reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
-
- NonRuleBasedDamagerRepairer ndr =
- new NonRuleBasedDamagerRepairer(
- new TextAttribute(
- colorManager.getColor(IXMLColorConstants.XML_COMMENT)));
- reconciler.setDamager(ndr, XMLPartitionScanner.XML_COMMENT);
- reconciler.setRepairer(ndr, XMLPartitionScanner.XML_COMMENT);
-
- return reconciler;
- }
-
- public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
- // Create content assistant
- ContentAssistant assistant = new ContentAssistant();
-
- // required to display additional info
- assistant.setInformationControlCreator(new IInformationControlCreator() {
- public IInformationControl createInformationControl(Shell parent) {
- return new DefaultInformationControl(parent);
- }
- });
-
- _processor = new IvyContentAssistProcessor();
- _processor.setFile(_file);
- // Set this processor for each supported content type
- assistant.setContentAssistProcessor(_processor, XMLPartitionScanner.XML_TAG);
- assistant.setContentAssistProcessor(_processor, XMLPartitionScanner.XML_DEFAULT);
- assistant.setContentAssistProcessor(_processor, IDocument.DEFAULT_CONTENT_TYPE);
-
- // Return the content assistant
- return assistant;
- }
-
- public void setFile(IFile file) {
- if (_processor != null) {
- _processor.setFile(file);
- }
- _file = file;
- }
-}
\ No newline at end of file
+package org.apache.ivyde.eclipse.ui.editors.xml;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jface.text.DefaultInformationControl;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IInformationControl;
+import org.eclipse.jface.text.IInformationControlCreator;
+import org.eclipse.jface.text.ITextDoubleClickStrategy;
+import org.eclipse.jface.text.TextAttribute;
+import org.eclipse.jface.text.contentassist.ContentAssistant;
+import org.eclipse.jface.text.contentassist.IContentAssistant;
+import org.eclipse.jface.text.presentation.IPresentationReconciler;
+import org.eclipse.jface.text.presentation.PresentationReconciler;
+import org.eclipse.jface.text.rules.DefaultDamagerRepairer;
+import org.eclipse.jface.text.rules.Token;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.jface.text.source.SourceViewerConfiguration;
+import org.eclipse.swt.widgets.Shell;
+
+public class XMLConfiguration extends SourceViewerConfiguration {
+ private XMLDoubleClickStrategy doubleClickStrategy;
+
+ private XMLTagScanner tagScanner;
+
+ private XMLScanner scanner;
+
+ private ColorManager colorManager;
+
+ private IProject project;
+
+ private IvyContentAssistProcessor _processor;
+
+ private IFile _file;
+
+ public XMLConfiguration(ColorManager colorManager) {
+ this.colorManager = colorManager;
+ }
+
+ public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
+ return new String[] {IDocument.DEFAULT_CONTENT_TYPE, XMLPartitionScanner.XML_COMMENT,
+ XMLPartitionScanner.XML_TAG};
+ }
+
+ public ITextDoubleClickStrategy getDoubleClickStrategy(ISourceViewer sourceViewer,
+ String contentType) {
+ if (doubleClickStrategy == null)
+ doubleClickStrategy = new XMLDoubleClickStrategy();
+ return doubleClickStrategy;
+ }
+
+ protected XMLScanner getXMLScanner() {
+ if (scanner == null) {
+ scanner = new XMLScanner(colorManager);
+ scanner.setDefaultReturnToken(new Token(new TextAttribute(colorManager
+ .getColor(IXMLColorConstants.DEFAULT))));
+ }
+ return scanner;
+ }
+
+ protected XMLTagScanner getXMLTagScanner() {
+ if (tagScanner == null) {
+ tagScanner = new XMLTagScanner(colorManager);
+ tagScanner.setDefaultReturnToken(new Token(new TextAttribute(colorManager
+ .getColor(IXMLColorConstants.TAG))));
+ }
+ return tagScanner;
+ }
+
+ public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
+ PresentationReconciler reconciler = new PresentationReconciler();
+
+ DefaultDamagerRepairer dr = new DefaultDamagerRepairer(getXMLTagScanner());
+ reconciler.setDamager(dr, XMLPartitionScanner.XML_TAG);
+ reconciler.setRepairer(dr, XMLPartitionScanner.XML_TAG);
+
+ dr = new DefaultDamagerRepairer(getXMLScanner());
+ reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
+ reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
+
+ NonRuleBasedDamagerRepairer ndr = new NonRuleBasedDamagerRepairer(new TextAttribute(
+ colorManager.getColor(IXMLColorConstants.XML_COMMENT)));
+ reconciler.setDamager(ndr, XMLPartitionScanner.XML_COMMENT);
+ reconciler.setRepairer(ndr, XMLPartitionScanner.XML_COMMENT);
+
+ return reconciler;
+ }
+
+ public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
+ // Create content assistant
+ ContentAssistant assistant = new ContentAssistant();
+
+ // required to display additional info
+ assistant.setInformationControlCreator(new IInformationControlCreator() {
+ public IInformationControl createInformationControl(Shell parent) {
+ return new DefaultInformationControl(parent);
+ }
+ });
+
+ _processor = new IvyContentAssistProcessor();
+ _processor.setFile(_file);
+ // Set this processor for each supported content type
+ assistant.setContentAssistProcessor(_processor, XMLPartitionScanner.XML_TAG);
+ assistant.setContentAssistProcessor(_processor, XMLPartitionScanner.XML_DEFAULT);
+ assistant.setContentAssistProcessor(_processor, IDocument.DEFAULT_CONTENT_TYPE);
+
+ // Return the content assistant
+ return assistant;
+ }
+
+ public void setFile(IFile file) {
+ if (_processor != null) {
+ _processor.setFile(file);
+ }
+ _file = file;
+ }
+}
Propchange: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLConfiguration.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLDocumentProvider.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLDocumentProvider.java?rev=611752&r1=611751&r2=611752&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLDocumentProvider.java (original)
+++ ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLDocumentProvider.java Mon Jan 14 02:26:37 2008
@@ -1,40 +1,37 @@
-package org.apache.ivyde.eclipse.ui.editors.xml;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IDocumentPartitioner;
-import org.eclipse.jface.text.rules.DefaultPartitioner;
-import org.eclipse.ui.editors.text.FileDocumentProvider;
-
-public class XMLDocumentProvider extends FileDocumentProvider {
-
- protected IDocument createDocument(Object element) throws CoreException {
- IDocument document = super.createDocument(element);
- if (document != null) {
- IDocumentPartitioner partitioner =
- new DefaultPartitioner(
- new XMLPartitionScanner(),
- new String[] {
- XMLPartitionScanner.XML_TAG,
- XMLPartitionScanner.XML_COMMENT });
- partitioner.connect(document);
- document.setDocumentPartitioner(partitioner);
-// document.addDocumentListener(new IDocumentListener() {
-//
-// public void documentAboutToBeChanged(DocumentEvent event) {
-// }
-//
-// public void documentChanged(DocumentEvent event) {
-// System.out.println("XMLDocumentProvider.documentChanged :"+event.getText());
-// }
-// });
- }
- return document;
- }
-
- protected void doSaveDocument(IProgressMonitor monitor, Object element, IDocument document, boolean overwrite) throws CoreException {
- // TODO Auto-generated method stub
- super.doSaveDocument(monitor, element, document, overwrite);
- }
-}
\ No newline at end of file
+package org.apache.ivyde.eclipse.ui.editors.xml;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IDocumentPartitioner;
+import org.eclipse.jface.text.rules.DefaultPartitioner;
+import org.eclipse.ui.editors.text.FileDocumentProvider;
+
+public class XMLDocumentProvider extends FileDocumentProvider {
+
+ protected IDocument createDocument(Object element) throws CoreException {
+ IDocument document = super.createDocument(element);
+ if (document != null) {
+ IDocumentPartitioner partitioner = new DefaultPartitioner(new XMLPartitionScanner(),
+ new String[] {XMLPartitionScanner.XML_TAG, XMLPartitionScanner.XML_COMMENT});
+ partitioner.connect(document);
+ document.setDocumentPartitioner(partitioner);
+ // document.addDocumentListener(new IDocumentListener() {
+ //
+ // public void documentAboutToBeChanged(DocumentEvent event) {
+ // }
+ //
+ // public void documentChanged(DocumentEvent event) {
+ // System.out.println("XMLDocumentProvider.documentChanged :"+event.getText());
+ // }
+ // });
+ }
+ return document;
+ }
+
+ protected void doSaveDocument(IProgressMonitor monitor, Object element, IDocument document,
+ boolean overwrite) throws CoreException {
+ // TODO Auto-generated method stub
+ super.doSaveDocument(monitor, element, document, overwrite);
+ }
+}
Propchange: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLDocumentProvider.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLDoubleClickStrategy.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLDoubleClickStrategy.java?rev=611752&r1=611751&r2=611752&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLDoubleClickStrategy.java (original)
+++ ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLDoubleClickStrategy.java Mon Jan 14 02:26:37 2008
@@ -1,112 +1,117 @@
-package org.apache.ivyde.eclipse.ui.editors.xml;
-
-import org.eclipse.jface.text.*;
-
-public class XMLDoubleClickStrategy implements ITextDoubleClickStrategy {
- protected ITextViewer fText;
-
- public void doubleClicked(ITextViewer part) {
- int pos = part.getSelectedRange().x;
-
- if (pos < 0)
- return;
-
- fText = part;
-
- if (!selectComment(pos)) {
- selectWord(pos);
- }
- }
- protected boolean selectComment(int caretPos) {
- IDocument doc = fText.getDocument();
- int startPos, endPos;
-
- try {
- int pos = caretPos;
- char c = ' ';
-
- while (pos >= 0) {
- c = doc.getChar(pos);
- if (c == '\\') {
- pos -= 2;
- continue;
- }
- if (c == Character.LINE_SEPARATOR || c == '\"')
- break;
- --pos;
- }
-
- if (c != '\"')
- return false;
-
- startPos = pos;
-
- pos = caretPos;
- int length = doc.getLength();
- c = ' ';
-
- while (pos < length) {
- c = doc.getChar(pos);
- if (c == Character.LINE_SEPARATOR || c == '\"')
- break;
- ++pos;
- }
- if (c != '\"')
- return false;
-
- endPos = pos;
-
- int offset = startPos + 1;
- int len = endPos - offset;
- fText.setSelectedRange(offset, len);
- return true;
- } catch (BadLocationException x) {
- }
-
- return false;
- }
- protected boolean selectWord(int caretPos) {
-
- IDocument doc = fText.getDocument();
- int startPos, endPos;
-
- try {
-
- int pos = caretPos;
- char c;
-
- while (pos >= 0) {
- c = doc.getChar(pos);
- if (!Character.isJavaIdentifierPart(c))
- break;
- --pos;
- }
-
- startPos = pos;
-
- pos = caretPos;
- int length = doc.getLength();
-
- while (pos < length) {
- c = doc.getChar(pos);
- if (!Character.isJavaIdentifierPart(c))
- break;
- ++pos;
- }
-
- endPos = pos;
- selectRange(startPos, endPos);
- return true;
-
- } catch (BadLocationException x) {
- }
-
- return false;
- }
-
- private void selectRange(int startPos, int stopPos) {
- int offset = startPos + 1;
- int length = stopPos - offset;
- fText.setSelectedRange(offset, length);
- }
-}
\ 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.IDocument;
+import org.eclipse.jface.text.ITextDoubleClickStrategy;
+import org.eclipse.jface.text.ITextViewer;
+
+public class XMLDoubleClickStrategy implements ITextDoubleClickStrategy {
+ protected ITextViewer fText;
+
+ public void doubleClicked(ITextViewer part) {
+ int pos = part.getSelectedRange().x;
+
+ if (pos < 0)
+ return;
+
+ fText = part;
+
+ if (!selectComment(pos)) {
+ selectWord(pos);
+ }
+ }
+
+ protected boolean selectComment(int caretPos) {
+ IDocument doc = fText.getDocument();
+ int startPos, endPos;
+
+ try {
+ int pos = caretPos;
+ char c = ' ';
+
+ while (pos >= 0) {
+ c = doc.getChar(pos);
+ if (c == '\\') {
+ pos -= 2;
+ continue;
+ }
+ if (c == Character.LINE_SEPARATOR || c == '\"')
+ break;
+ --pos;
+ }
+
+ if (c != '\"')
+ return false;
+
+ startPos = pos;
+
+ pos = caretPos;
+ int length = doc.getLength();
+ c = ' ';
+
+ while (pos < length) {
+ c = doc.getChar(pos);
+ if (c == Character.LINE_SEPARATOR || c == '\"')
+ break;
+ ++pos;
+ }
+ if (c != '\"')
+ return false;
+
+ endPos = pos;
+
+ int offset = startPos + 1;
+ int len = endPos - offset;
+ fText.setSelectedRange(offset, len);
+ return true;
+ } catch (BadLocationException x) {
+ }
+
+ return false;
+ }
+
+ protected boolean selectWord(int caretPos) {
+
+ IDocument doc = fText.getDocument();
+ int startPos, endPos;
+
+ try {
+
+ int pos = caretPos;
+ char c;
+
+ while (pos >= 0) {
+ c = doc.getChar(pos);
+ if (!Character.isJavaIdentifierPart(c))
+ break;
+ --pos;
+ }
+
+ startPos = pos;
+
+ pos = caretPos;
+ int length = doc.getLength();
+
+ while (pos < length) {
+ c = doc.getChar(pos);
+ if (!Character.isJavaIdentifierPart(c))
+ break;
+ ++pos;
+ }
+
+ endPos = pos;
+ selectRange(startPos, endPos);
+ return true;
+
+ } catch (BadLocationException x) {
+ }
+
+ return false;
+ }
+
+ private void selectRange(int startPos, int stopPos) {
+ int offset = startPos + 1;
+ int length = stopPos - offset;
+ fText.setSelectedRange(offset, length);
+ }
+}
Propchange: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLDoubleClickStrategy.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLEditor.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLEditor.java?rev=611752&r1=611751&r2=611752&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLEditor.java (original)
+++ ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLEditor.java Mon Jan 14 02:26:37 2008
@@ -1,54 +1,53 @@
-package org.apache.ivyde.eclipse.ui.editors.xml;
-
-import org.apache.ivyde.eclipse.IvyPlugin;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.text.source.SourceViewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.ui.editors.text.TextEditor;
-import org.eclipse.ui.texteditor.TextOperationAction;
-
-
-public class XMLEditor extends TextEditor {
-
- private ColorManager colorManager;
-
- public XMLEditor() {
- super();
- colorManager = new ColorManager();
- _configuration = new XMLConfiguration(colorManager);
- setSourceViewerConfiguration(_configuration);
- setDocumentProvider(new XMLDocumentProvider());
-
- }
-
- public void dispose() {
- colorManager.dispose();
- super.dispose();
- }
-
- private static final String CONTENTASSIST_PROPOSAL_ID = "org.apache.ivyde.ContentAssistProposal";
- private XMLConfiguration _configuration;
-
- protected void createActions() {
- super.createActions();
-
- // This action will fire a CONTENTASSIST_PROPOSALS operation
- // when executed
- IAction action = new TextOperationAction(IvyPlugin.getDefault().getResourceBundle(), "ContentAssistProposal", this, SourceViewer.CONTENTASSIST_PROPOSALS);
- action.setActionDefinitionId(CONTENTASSIST_PROPOSAL_ID);
-
- // Tell the editor about this new action
- setAction(CONTENTASSIST_PROPOSAL_ID, action);
-
- // Tell the editor to execute this action
- // when Ctrl+Spacebar is pressed
- setActionActivationCode(CONTENTASSIST_PROPOSAL_ID, ' ', -1, SWT.CTRL);
- }
-
- public void setFile(IFile file) {
- _configuration.setFile(file);
- }
-}
+package org.apache.ivyde.eclipse.ui.editors.xml;
+
+import org.apache.ivyde.eclipse.IvyPlugin;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.text.source.SourceViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.ui.editors.text.TextEditor;
+import org.eclipse.ui.texteditor.TextOperationAction;
+
+public class XMLEditor extends TextEditor {
+
+ private ColorManager colorManager;
+
+ public XMLEditor() {
+ super();
+ colorManager = new ColorManager();
+ _configuration = new XMLConfiguration(colorManager);
+ setSourceViewerConfiguration(_configuration);
+ setDocumentProvider(new XMLDocumentProvider());
+
+ }
+
+ public void dispose() {
+ colorManager.dispose();
+ super.dispose();
+ }
+
+ private static final String CONTENTASSIST_PROPOSAL_ID = "org.apache.ivyde.ContentAssistProposal";
+
+ private XMLConfiguration _configuration;
+
+ protected void createActions() {
+ super.createActions();
+
+ // This action will fire a CONTENTASSIST_PROPOSALS operation
+ // when executed
+ IAction action = new TextOperationAction(IvyPlugin.getDefault().getResourceBundle(),
+ "ContentAssistProposal", this, SourceViewer.CONTENTASSIST_PROPOSALS);
+ action.setActionDefinitionId(CONTENTASSIST_PROPOSAL_ID);
+
+ // Tell the editor about this new action
+ setAction(CONTENTASSIST_PROPOSAL_ID, action);
+
+ // Tell the editor to execute this action
+ // when Ctrl+Spacebar is pressed
+ setActionActivationCode(CONTENTASSIST_PROPOSAL_ID, ' ', -1, SWT.CTRL);
+ }
+
+ public void setFile(IFile file) {
+ _configuration.setFile(file);
+ }
+}
Propchange: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLEditor.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLPartitionScanner.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLPartitionScanner.java?rev=611752&r1=611751&r2=611752&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLPartitionScanner.java (original)
+++ ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLPartitionScanner.java Mon Jan 14 02:26:37 2008
@@ -1,23 +1,28 @@
-package org.apache.ivyde.eclipse.ui.editors.xml;
-
-import org.eclipse.jface.text.rules.*;
-
-
-public class XMLPartitionScanner extends RuleBasedPartitionScanner {
- public final static String XML_DEFAULT = "__xml_default";
- public final static String XML_COMMENT = "__xml_comment";
- public final static String XML_TAG = "__xml_tag";
-
- public XMLPartitionScanner() {
-
- IToken xmlComment = new Token(XML_COMMENT);
- IToken tag = new Token(XML_TAG);
-
- IPredicateRule[] rules = new IPredicateRule[2];
-
- rules[0] = new MultiLineRule("<!--", "-->", xmlComment);
- rules[1] = new TagRule(tag);
-
- setPredicateRules(rules);
- }
-}
+package org.apache.ivyde.eclipse.ui.editors.xml;
+
+import org.eclipse.jface.text.rules.IPredicateRule;
+import org.eclipse.jface.text.rules.IToken;
+import org.eclipse.jface.text.rules.MultiLineRule;
+import org.eclipse.jface.text.rules.RuleBasedPartitionScanner;
+import org.eclipse.jface.text.rules.Token;
+
+public class XMLPartitionScanner extends RuleBasedPartitionScanner {
+ public final static String XML_DEFAULT = "__xml_default";
+
+ public final static String XML_COMMENT = "__xml_comment";
+
+ public final static String XML_TAG = "__xml_tag";
+
+ public XMLPartitionScanner() {
+
+ IToken xmlComment = new Token(XML_COMMENT);
+ IToken tag = new Token(XML_TAG);
+
+ IPredicateRule[] rules = new IPredicateRule[2];
+
+ rules[0] = new MultiLineRule("<!--", "-->", xmlComment);
+ rules[1] = new TagRule(tag);
+
+ setPredicateRules(rules);
+ }
+}
Propchange: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLPartitionScanner.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLScanner.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLScanner.java?rev=611752&r1=611751&r2=611752&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLScanner.java (original)
+++ ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLScanner.java Mon Jan 14 02:26:37 2008
@@ -1,23 +1,25 @@
-package org.apache.ivyde.eclipse.ui.editors.xml;
-
-import org.eclipse.jface.text.rules.*;
-import org.eclipse.jface.text.*;
-
-
-public class XMLScanner extends RuleBasedScanner {
-
- public XMLScanner(ColorManager manager) {
- IToken procInstr =
- new Token(
- new TextAttribute(
- manager.getColor(IXMLColorConstants.PROC_INSTR)));
-
- IRule[] rules = new IRule[2];
- //Add rule for processing instructions
- rules[0] = new SingleLineRule("<?", "?>", procInstr);
- // Add generic whitespace rule.
- rules[1] = new WhitespaceRule(new XMLWhitespaceDetector());
-
- setRules(rules);
- }
-}
+package org.apache.ivyde.eclipse.ui.editors.xml;
+
+import org.eclipse.jface.text.TextAttribute;
+import org.eclipse.jface.text.rules.IRule;
+import org.eclipse.jface.text.rules.IToken;
+import org.eclipse.jface.text.rules.RuleBasedScanner;
+import org.eclipse.jface.text.rules.SingleLineRule;
+import org.eclipse.jface.text.rules.Token;
+import org.eclipse.jface.text.rules.WhitespaceRule;
+
+public class XMLScanner extends RuleBasedScanner {
+
+ public XMLScanner(ColorManager manager) {
+ IToken procInstr = new Token(new TextAttribute(manager
+ .getColor(IXMLColorConstants.PROC_INSTR)));
+
+ IRule[] rules = new IRule[2];
+ // Add rule for processing instructions
+ rules[0] = new SingleLineRule("<?", "?>", procInstr);
+ // Add generic whitespace rule.
+ rules[1] = new WhitespaceRule(new XMLWhitespaceDetector());
+
+ setRules(rules);
+ }
+}
Propchange: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLScanner.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLTagScanner.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLTagScanner.java?rev=611752&r1=611751&r2=611752&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLTagScanner.java (original)
+++ ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLTagScanner.java Mon Jan 14 02:26:37 2008
@@ -1,25 +1,27 @@
-package org.apache.ivyde.eclipse.ui.editors.xml;
-
-import org.eclipse.jface.text.*;
-import org.eclipse.jface.text.rules.*;
-
-
-public class XMLTagScanner extends RuleBasedScanner {
-
- public XMLTagScanner(ColorManager manager) {
- IToken string =
- new Token(
- new TextAttribute(manager.getColor(IXMLColorConstants.STRING)));
-
- IRule[] rules = new IRule[3];
-
- // Add rule for double quotes
- rules[0] = new SingleLineRule("\"", "\"", string, '\\');
- // Add a rule for single quotes
- rules[1] = new SingleLineRule("'", "'", string, '\\');
- // Add generic whitespace rule.
- rules[2] = new WhitespaceRule(new XMLWhitespaceDetector());
-
- setRules(rules);
- }
-}
+package org.apache.ivyde.eclipse.ui.editors.xml;
+
+import org.eclipse.jface.text.TextAttribute;
+import org.eclipse.jface.text.rules.IRule;
+import org.eclipse.jface.text.rules.IToken;
+import org.eclipse.jface.text.rules.RuleBasedScanner;
+import org.eclipse.jface.text.rules.SingleLineRule;
+import org.eclipse.jface.text.rules.Token;
+import org.eclipse.jface.text.rules.WhitespaceRule;
+
+public class XMLTagScanner extends RuleBasedScanner {
+
+ public XMLTagScanner(ColorManager manager) {
+ IToken string = new Token(new TextAttribute(manager.getColor(IXMLColorConstants.STRING)));
+
+ IRule[] rules = new IRule[3];
+
+ // Add rule for double quotes
+ rules[0] = new SingleLineRule("\"", "\"", string, '\\');
+ // Add a rule for single quotes
+ rules[1] = new SingleLineRule("'", "'", string, '\\');
+ // Add generic whitespace rule.
+ rules[2] = new WhitespaceRule(new XMLWhitespaceDetector());
+
+ setRules(rules);
+ }
+}
Propchange: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLTagScanner.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLWhitespaceDetector.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLWhitespaceDetector.java?rev=611752&r1=611751&r2=611752&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLWhitespaceDetector.java (original)
+++ ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLWhitespaceDetector.java Mon Jan 14 02:26:37 2008
@@ -1,10 +1,10 @@
-package org.apache.ivyde.eclipse.ui.editors.xml;
-
-import org.eclipse.jface.text.rules.IWhitespaceDetector;
-
-public class XMLWhitespaceDetector implements IWhitespaceDetector {
-
- public boolean isWhitespace(char c) {
- return (c == ' ' || c == '\t' || c == '\n' || c == '\r');
- }
-}
+package org.apache.ivyde.eclipse.ui.editors.xml;
+
+import org.eclipse.jface.text.rules.IWhitespaceDetector;
+
+public class XMLWhitespaceDetector implements IWhitespaceDetector {
+
+ public boolean isWhitespace(char c) {
+ return (c == ' ' || c == '\t' || c == '\n' || c == '\r');
+ }
+}
Propchange: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLWhitespaceDetector.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyPreferencePage.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyPreferencePage.java?rev=611752&r1=611751&r2=611752&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyPreferencePage.java (original)
+++ ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyPreferencePage.java Mon Jan 14 02:26:37 2008
@@ -1,165 +1,179 @@
-package org.apache.ivyde.eclipse.ui.preferences;
-
-import java.io.File;
-import java.net.MalformedURLException;
-
-import org.apache.ivy.Ivy;
-import org.apache.ivyde.eclipse.IvyPlugin;
-import org.eclipse.jface.preference.BooleanFieldEditor;
-import org.eclipse.jface.preference.FieldEditorPreferencePage;
-import org.eclipse.jface.preference.FileFieldEditor;
-import org.eclipse.jface.preference.StringFieldEditor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-
-
-/**
- * This class represents a preference page that
- * is contributed to the Preferences dialog. By
- * subclassing <samp>FieldEditorPreferencePage</samp>, we
- * can use the field support built into JFace that allows
- * us to create a page that is small and knows how to
- * save, restore and apply itself.
- * <p>
- * This page is used to modify preferences only. They
- * are stored in the preference store that belongs to
- * the main plug-in class. That way, preferences can
- * be accessed directly via the preference store.
- */
-
-public class IvyPreferencePage
- extends FieldEditorPreferencePage
- implements IWorkbenchPreferencePage {
-
- private StringFieldEditor _pattern;
-
- public IvyPreferencePage() {
- super(GRID);
- setPreferenceStore(IvyPlugin.getDefault().getPreferenceStore());
- setDescription("");
- }
-
- /**
- * Creates the field editors. Field editors are abstractions of
- * the common GUI blocks needed to manipulate various types
- * of preferences. Each field editor knows how to save and
- * restore itself.
- */
- public void createFieldEditors() {
- final Composite fieldParent = getFieldEditorParent();
-
- Label info = new Label(fieldParent, SWT.NONE);
- info.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, 3, 1));
- info.setText("Apache Ivy version " + Ivy.getIvyVersion() + " - "
- + Ivy.getIvyDate());
- new Label(fieldParent, SWT.NONE).setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, 3, 1)); // space
-
- Label spacer = new Label(fieldParent, SWT.NONE);
- GridData spacerData = new GridData();
- spacerData.horizontalSpan = 3;
- spacer.setLayoutData(spacerData);
- spacer.setText("Runtime option");
- spacer = new Label(fieldParent, SWT.SEPARATOR | SWT.HORIZONTAL );
- spacer.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 3, 1));
- addField(new FileFieldEditor(PreferenceConstants.IVYCONF_PATH, "&IvyConf URL:", fieldParent) {
- /*Opens the file chooser dialog and returns the selected file as an url. */
- protected String changePressed() {
- String f = super.changePressed();
- if (f == null) {
- return null;
- } else {
- File d = new File(f);
- try {
- return d.toURL().toExternalForm();
- } catch (MalformedURLException e) {
- return null;
- }
- }
- }
-
- protected boolean checkState() {
- return true;
- }
- });
-
- new Label(fieldParent, SWT.NONE); // space
- Label explanation = new Label(fieldParent, SWT.NONE);
- explanation.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, 2, 1));
- explanation.setText("The url where your ivyconf file can be found. \nUse default to reference the default ivy configuration.");
- new Label(fieldParent, SWT.NONE).setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, 3, 1)); // space
-
-
- BooleanFieldEditor doR = new BooleanFieldEditor(PreferenceConstants.DO_RETRIEVE, "Do a retrieve after resolve", fieldParent) {
- protected void createControl(final Composite parent) {
- super.createControl(parent);
- final Button b = getChangeControl(parent);
- b.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- _pattern.setEnabled(b.getSelection(), parent);
- }
- });
- }
- };
- _pattern = new StringFieldEditor(PreferenceConstants.RETRIEVE_PATTERN, "Pattern", fieldParent);
- _pattern.setEnabled(getPreferenceStore().getBoolean(PreferenceConstants.DO_RETRIEVE), fieldParent);
- addField(doR);
- addField(_pattern);
-
- new Label(fieldParent, SWT.NONE); // space
- explanation = new Label(fieldParent, SWT.NONE);
- explanation.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, 2, 1));
- explanation.setText("Pattern example: lib/[conf]/[artifact].[ext]\nTo copy artifacts in folder named lib without revision by folder named like configurations");
- new Label(fieldParent, SWT.NONE).setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, 3, 1)); // space
-
- addField(new StringFieldEditor(PreferenceConstants.ACCEPTED_TYPES, "Accepted types", fieldParent));
-
- new Label(fieldParent, SWT.NONE); // space
- explanation = new Label(fieldParent, SWT.NONE);
- explanation.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, 2, 1));
- explanation.setText("Comma separated list of artifact types to use in IvyDE Managed Dependencies Library\nExample: jar, zip");
-
- addField(new StringFieldEditor(PreferenceConstants.SOURCES_TYPES, "Sources types", fieldParent));
-
- new Label(fieldParent, SWT.NONE); // space
- explanation = new Label(fieldParent, SWT.NONE);
- explanation.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, 2, 1));
- explanation.setText("Comma separated list of artifact types to be used as sources. \nExample: source, src");
-
- addField(new StringFieldEditor(PreferenceConstants.JAVADOC_TYPES, "Javadoc types", fieldParent));
-
- new Label(fieldParent, SWT.NONE); // space
- explanation = new Label(fieldParent, SWT.NONE);
- explanation.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, 2, 1));
- explanation.setText("Comma separated list of artifact types to be used as javadoc. \nExample: javadoc");
-
- spacer = new Label(fieldParent, SWT.NONE);
- spacerData = new GridData();
- spacerData.horizontalSpan = 3;
- spacer.setLayoutData(spacerData);
-
- spacer = new Label(fieldParent, SWT.NONE);
- spacerData = new GridData();
- spacerData.horizontalSpan = 3;
- spacer.setLayoutData(spacerData);
- spacer.setText("Editor information");
- spacer = new Label(fieldParent, SWT.SEPARATOR | SWT.HORIZONTAL );
- spacer.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 3, 1));
- addField(new StringFieldEditor(PreferenceConstants.ORGANISATION, "&Organisation:", fieldParent));
- addField(new StringFieldEditor(PreferenceConstants.ORGANISATION_URL, "Organisation &URL:", fieldParent));
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
- */
- public void init(IWorkbench workbench) {
- }
-
-}
\ No newline at end of file
+package org.apache.ivyde.eclipse.ui.preferences;
+
+import java.io.File;
+import java.net.MalformedURLException;
+
+import org.apache.ivy.Ivy;
+import org.apache.ivyde.eclipse.IvyPlugin;
+import org.eclipse.jface.preference.BooleanFieldEditor;
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.jface.preference.FileFieldEditor;
+import org.eclipse.jface.preference.StringFieldEditor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+/**
+ * This class represents a preference page that is contributed to the Preferences dialog. By
+ * subclassing <samp>FieldEditorPreferencePage</samp>, we can use the field support built into
+ * JFace that allows us to create a page that is small and knows how to save, restore and apply
+ * itself.
+ * <p>
+ * This page is used to modify preferences only. They are stored in the preference store that
+ * belongs to the main plug-in class. That way, preferences can be accessed directly via the
+ * preference store.
+ */
+
+public class IvyPreferencePage extends FieldEditorPreferencePage implements
+ IWorkbenchPreferencePage {
+
+ private StringFieldEditor _pattern;
+
+ public IvyPreferencePage() {
+ super(GRID);
+ setPreferenceStore(IvyPlugin.getDefault().getPreferenceStore());
+ setDescription("");
+ }
+
+ /**
+ * Creates the field editors. Field editors are abstractions of the common GUI blocks needed to
+ * manipulate various types of preferences. Each field editor knows how to save and restore
+ * itself.
+ */
+ public void createFieldEditors() {
+ final Composite fieldParent = getFieldEditorParent();
+
+ Label info = new Label(fieldParent, SWT.NONE);
+ info.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, 3, 1));
+ info.setText("Apache Ivy version " + Ivy.getIvyVersion() + " - " + Ivy.getIvyDate());
+ new Label(fieldParent, SWT.NONE).setLayoutData(new GridData(GridData.FILL,
+ GridData.BEGINNING, false, false, 3, 1)); // space
+
+ Label spacer = new Label(fieldParent, SWT.NONE);
+ GridData spacerData = new GridData();
+ spacerData.horizontalSpan = 3;
+ spacer.setLayoutData(spacerData);
+ spacer.setText("Runtime option");
+ spacer = new Label(fieldParent, SWT.SEPARATOR | SWT.HORIZONTAL);
+ spacer.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 3, 1));
+ addField(new FileFieldEditor(PreferenceConstants.IVYCONF_PATH, "&IvyConf URL:", fieldParent) {
+ /* Opens the file chooser dialog and returns the selected file as an url. */
+ protected String changePressed() {
+ String f = super.changePressed();
+ if (f == null) {
+ return null;
+ } else {
+ File d = new File(f);
+ try {
+ return d.toURL().toExternalForm();
+ } catch (MalformedURLException e) {
+ return null;
+ }
+ }
+ }
+
+ protected boolean checkState() {
+ return true;
+ }
+ });
+
+ new Label(fieldParent, SWT.NONE); // space
+ Label explanation = new Label(fieldParent, SWT.NONE);
+ explanation.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, 2,
+ 1));
+ explanation
+ .setText("The url where your ivyconf file can be found. \nUse default to reference the default ivy configuration.");
+ new Label(fieldParent, SWT.NONE).setLayoutData(new GridData(GridData.FILL,
+ GridData.BEGINNING, false, false, 3, 1)); // space
+
+ BooleanFieldEditor doR = new BooleanFieldEditor(PreferenceConstants.DO_RETRIEVE,
+ "Do a retrieve after resolve", fieldParent) {
+ protected void createControl(final Composite parent) {
+ super.createControl(parent);
+ final Button b = getChangeControl(parent);
+ b.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ _pattern.setEnabled(b.getSelection(), parent);
+ }
+ });
+ }
+ };
+ _pattern = new StringFieldEditor(PreferenceConstants.RETRIEVE_PATTERN, "Pattern",
+ fieldParent);
+ _pattern.setEnabled(getPreferenceStore().getBoolean(PreferenceConstants.DO_RETRIEVE),
+ fieldParent);
+ addField(doR);
+ addField(_pattern);
+
+ new Label(fieldParent, SWT.NONE); // space
+ explanation = new Label(fieldParent, SWT.NONE);
+ explanation.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, 2,
+ 1));
+ explanation
+ .setText("Pattern example: lib/[conf]/[artifact].[ext]\nTo copy artifacts in folder named lib without revision by folder named like configurations");
+ new Label(fieldParent, SWT.NONE).setLayoutData(new GridData(GridData.FILL,
+ GridData.BEGINNING, false, false, 3, 1)); // space
+
+ addField(new StringFieldEditor(PreferenceConstants.ACCEPTED_TYPES, "Accepted types",
+ fieldParent));
+
+ new Label(fieldParent, SWT.NONE); // space
+ explanation = new Label(fieldParent, SWT.NONE);
+ explanation.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, 2,
+ 1));
+ explanation
+ .setText("Comma separated list of artifact types to use in IvyDE Managed Dependencies Library\nExample: jar, zip");
+
+ addField(new StringFieldEditor(PreferenceConstants.SOURCES_TYPES, "Sources types",
+ fieldParent));
+
+ new Label(fieldParent, SWT.NONE); // space
+ explanation = new Label(fieldParent, SWT.NONE);
+ explanation.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, 2,
+ 1));
+ explanation
+ .setText("Comma separated list of artifact types to be used as sources. \nExample: source, src");
+
+ addField(new StringFieldEditor(PreferenceConstants.JAVADOC_TYPES, "Javadoc types",
+ fieldParent));
+
+ new Label(fieldParent, SWT.NONE); // space
+ explanation = new Label(fieldParent, SWT.NONE);
+ explanation.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, 2,
+ 1));
+ explanation
+ .setText("Comma separated list of artifact types to be used as javadoc. \nExample: javadoc");
+
+ spacer = new Label(fieldParent, SWT.NONE);
+ spacerData = new GridData();
+ spacerData.horizontalSpan = 3;
+ spacer.setLayoutData(spacerData);
+
+ spacer = new Label(fieldParent, SWT.NONE);
+ spacerData = new GridData();
+ spacerData.horizontalSpan = 3;
+ spacer.setLayoutData(spacerData);
+ spacer.setText("Editor information");
+ spacer = new Label(fieldParent, SWT.SEPARATOR | SWT.HORIZONTAL);
+ spacer.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 3, 1));
+ addField(new StringFieldEditor(PreferenceConstants.ORGANISATION, "&Organisation:",
+ fieldParent));
+ addField(new StringFieldEditor(PreferenceConstants.ORGANISATION_URL, "Organisation &URL:",
+ fieldParent));
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+ */
+ public void init(IWorkbench workbench) {
+ }
+
+}
Propchange: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyPreferencePage.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceConstants.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceConstants.java?rev=611752&r1=611751&r2=611752&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceConstants.java (original)
+++ ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceConstants.java Mon Jan 14 02:26:37 2008
@@ -1,24 +1,30 @@
-package org.apache.ivyde.eclipse.ui.preferences;
-
-/**
- * Constant definitions for plug-in preferences
- */
-public class PreferenceConstants {
-
- public static final String IVYCONF_PATH = "ivy_conf_path";
- public static final String ORGANISATION = "ivy_org";
- public static final String ORGANISATION_URL = "ivy_org_url";
-
- public static final String ACCEPTED_TYPES = "acceptedTypes";
- public static final String SOURCES_TYPES = "sourceTypes";
- public static final String JAVADOC_TYPES = "javadocTypes";
-
- public static final String P_BOOLEAN = "booleanPreference";
-
- public static final String P_CHOICE = "choicePreference";
-
- public static final String P_STRING = "stringPreference";
- public static final String DO_RETRIEVE = "do.retreive";
- public static final String RETRIEVE_PATTERN = "retreive.pattern";
-
-}
+package org.apache.ivyde.eclipse.ui.preferences;
+
+/**
+ * Constant definitions for plug-in preferences
+ */
+public class PreferenceConstants {
+
+ public static final String IVYCONF_PATH = "ivy_conf_path";
+
+ public static final String ORGANISATION = "ivy_org";
+
+ public static final String ORGANISATION_URL = "ivy_org_url";
+
+ public static final String ACCEPTED_TYPES = "acceptedTypes";
+
+ public static final String SOURCES_TYPES = "sourceTypes";
+
+ public static final String JAVADOC_TYPES = "javadocTypes";
+
+ public static final String P_BOOLEAN = "booleanPreference";
+
+ public static final String P_CHOICE = "choicePreference";
+
+ public static final String P_STRING = "stringPreference";
+
+ public static final String DO_RETRIEVE = "do.retreive";
+
+ public static final String RETRIEVE_PATTERN = "retreive.pattern";
+
+}
Propchange: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceConstants.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceInitializer.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceInitializer.java?rev=611752&r1=611751&r2=611752&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceInitializer.java (original)
+++ ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceInitializer.java Mon Jan 14 02:26:37 2008
@@ -1,27 +1,24 @@
-package org.apache.ivyde.eclipse.ui.preferences;
-
-import org.apache.ivyde.eclipse.IvyPlugin;
-import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
-import org.eclipse.jface.preference.IPreferenceStore;
-
-
-/**
- * Class used to initialize default preference values.
- */
-public class PreferenceInitializer extends AbstractPreferenceInitializer {
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
- */
- public void initializeDefaultPreferences() {
- IPreferenceStore store = IvyPlugin.getDefault()
- .getPreferenceStore();
- store.setDefault(PreferenceConstants.P_BOOLEAN, true);
- store.setDefault(PreferenceConstants.P_CHOICE, "choice2");
- store.setDefault(PreferenceConstants.P_STRING,
- "Default value");
- }
-
-}
+package org.apache.ivyde.eclipse.ui.preferences;
+
+import org.apache.ivyde.eclipse.IvyPlugin;
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.jface.preference.IPreferenceStore;
+
+/**
+ * Class used to initialize default preference values.
+ */
+public class PreferenceInitializer extends AbstractPreferenceInitializer {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
+ */
+ public void initializeDefaultPreferences() {
+ IPreferenceStore store = IvyPlugin.getDefault().getPreferenceStore();
+ store.setDefault(PreferenceConstants.P_BOOLEAN, true);
+ store.setDefault(PreferenceConstants.P_CHOICE, "choice2");
+ store.setDefault(PreferenceConstants.P_STRING, "Default value");
+ }
+
+}
Propchange: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceInitializer.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/properties/IvyProjectPropertyPage.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/properties/IvyProjectPropertyPage.java?rev=611752&r1=611751&r2=611752&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/properties/IvyProjectPropertyPage.java (original)
+++ ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/properties/IvyProjectPropertyPage.java Mon Jan 14 02:26:37 2008
@@ -1,255 +1,279 @@
-package org.apache.ivyde.eclipse.ui.properties;
-
-import java.io.File;
-import java.net.MalformedURLException;
-
-import org.apache.ivyde.eclipse.IvyPlugin;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.dialogs.PropertyPage;
-
-
-public class IvyProjectPropertyPage extends PropertyPage {
-
- private static final String PATH_TITLE = "Ivy settings url:";
- private static final String ACCEPTED_TYPES_TITLE = "Accepted types:";
- private static final String SOURCES_TYPES_TITLE = "Sources types:";
- private static final String JAVADOC_TYPES_TITLE = "Javadoc types:";
-
- private Text _pathValueText;
-
- private Button _retreiveB;
-
- private Text _patternT;
- private Text _acceptedTypesText;
- private Text _sourcesTypesText;
- private Text _javadocTypesText;
-
- public IvyProjectPropertyPage() {
- super();
- }
-
- private void addMainSection(Composite parent) {
- Composite composite = createDefaultComposite(parent);
-
-
- //Label for path field
- Label pathLabel = new Label(composite, SWT.NONE);
- pathLabel.setText(PATH_TITLE);
-
- _pathValueText = new Text(composite, SWT.SINGLE | SWT.BORDER);
- String ivyconfURL = IvyPlugin.getStrictIvyconfURL(getJavaProject());
- if (ivyconfURL == null) {
- ivyconfURL = getDefaultIvyconfURLForDisplay();
- }
- _pathValueText.setText(ivyconfURL);
- _pathValueText.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true, false, 2, 1));
-
- Button btn = new Button(composite, SWT.NONE);
- btn.setText("Browse");
- btn.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- File f = getFile(new File("/"));
- if (f != null) {
- try {
- _pathValueText.setText(f.toURL().toExternalForm());
- } catch (MalformedURLException e1) {
- }
- }
- }
- });
-
- new Label(composite, SWT.NONE); // space
- Label explanation = new Label(composite, SWT.NONE);
- explanation.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, 3, 1));
- explanation.setText("The url where your ivysettings file can be found. \nUse 'default' to reference the default ivy settings. \nUse '[inherited]' to use your general eclipse setting.\nRelative paths are handled relative to the project. Example: 'file://./ivysettings.xml'.");
- new Label(composite, SWT.NONE).setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, 4, 1)); // space
-
-
- Label acceptedTypesLabel = new Label(composite, SWT.NONE);
- acceptedTypesLabel.setText(ACCEPTED_TYPES_TITLE);
-
- _acceptedTypesText = new Text(composite, SWT.SINGLE | SWT.BORDER);
- _acceptedTypesText.setText(IvyPlugin.getAcceptedTypesString(getJavaProject()));
- _acceptedTypesText.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true, false, 3, 1));
-
- new Label(composite, SWT.NONE); // space
- explanation = new Label(composite, SWT.NONE);
- explanation.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, 3, 1));
- explanation.setText("Comma separated list of artifact types to use in IvyDE Managed Dependencies Library.\nExample: jar, zip\nUse [inherited] to use your general eclise setting.");
-
- Label sourcesTypesLabel = new Label(composite, SWT.NONE);
- sourcesTypesLabel.setText(SOURCES_TYPES_TITLE);
-
- _sourcesTypesText = new Text(composite, SWT.SINGLE | SWT.BORDER);
- _sourcesTypesText.setText(IvyPlugin.getSourcesTypesString(getJavaProject()));
- _sourcesTypesText.setToolTipText("Example: source, src\nUse [inherited] to use your general eclise setting.");
- _sourcesTypesText.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true, false, 3, 1));
-
- new Label(composite, SWT.NONE); // space
- explanation = new Label(composite, SWT.NONE);
- explanation.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, 3, 1));
- explanation.setText("Comma separated list of artifact types to be used as sources.");
-
- Label javadocTypesLabel = new Label(composite, SWT.NONE);
- javadocTypesLabel.setText(JAVADOC_TYPES_TITLE);
-
- _javadocTypesText = new Text(composite, SWT.SINGLE | SWT.BORDER);
- _javadocTypesText.setText(IvyPlugin.getJavadocTypesString(getJavaProject()));
- _javadocTypesText.setToolTipText("Example: javadoc\nUse [inherited] to use your general eclise setting.");
- _javadocTypesText.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true, false, 3, 1));
-
- new Label(composite, SWT.NONE); // space
- explanation = new Label(composite, SWT.NONE);
- explanation.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, 3, 1));
- explanation.setText("Comma separated list of artifact types to be used as javadoc.");
-
- new Label(composite, SWT.NONE).setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, 4, 1)); // space
-
- _retreiveB = new Button(composite, SWT.CHECK);
- _retreiveB.setText("Do retrieve after resolve");
- _retreiveB.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, 4, 1));
-
- new Label(composite, SWT.NONE).setText("Pattern:");
- _patternT = new Text(composite, SWT.SINGLE | SWT.BORDER);
- _patternT.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true, false, 3, 1));
- _retreiveB.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- _patternT.setEnabled(_retreiveB.getSelection());
- }
- });
- _retreiveB.setSelection(IvyPlugin.shouldDoRetrieve(getJavaProject()));
- _patternT.setEnabled(_retreiveB.getSelection());
- _patternT.setText(IvyPlugin.getRetrievePatternHerited(getJavaProject()));
-
- new Label(composite, SWT.NONE); // space
- explanation = new Label(composite, SWT.NONE);
- explanation.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, 3, 1));
- explanation.setText("Example: lib/[conf]/[artifact].[ext]\nTo copy artifacts in folder named lib without revision by folder named like configurations\nUse [inherited] to use your general eclipse setting.");
- new Label(composite, SWT.NONE).setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, 4, 1)); // space
- }
-
- /**
- * Try to get a JavaProject from the getElement() result.
- * Throws a IllegalStateException if it can't succeed.
- * @return
- */
- private IJavaProject getJavaProject() {
- IAdaptable adaptable = getElement();
- IJavaProject project = null;
- if (adaptable instanceof IJavaProject) {
- project = (IJavaProject)adaptable;
- } else if (adaptable instanceof IProject) {
- project = JavaCore.create((IProject)adaptable);
- } else {
- throw new IllegalStateException("Attempting a IProject element ! Not " + adaptable.getClass().getName() + " element");
- }
- return project;
- }
-
- /**
- * Helper to open the file chooser dialog.
- * @param startingDirectory the directory to open the dialog on.
- * @return File The File the user selected or <code>null</code> if they
- * do not.
- */
- private File getFile(File startingDirectory) {
-
- FileDialog dialog = new FileDialog(getShell(), SWT.OPEN);
- if (startingDirectory != null)
- dialog.setFileName(startingDirectory.getPath());
- dialog.setFilterExtensions(new String[] {"*.xml", "*"});
- String file = dialog.open();
- if (file != null) {
- file = file.trim();
- if (file.length() > 0)
- return new File(file);
- }
-
- return null;
- }
-
- /**
- * @see PreferencePage#createContents(Composite)
- */
- protected Control createContents(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout(1, false);
- composite.setLayout(layout);
- GridData data = new GridData(GridData.FILL);
- data.grabExcessHorizontalSpace = true;
- composite.setLayoutData(data);
-
- addMainSection(composite);
- return composite;
- }
-
- private Composite createDefaultComposite(Composite parent) {
- Composite composite = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
- layout.numColumns = 4;
- composite.setLayout(layout);
-
- GridData data = new GridData();
- data.grabExcessHorizontalSpace = true;
- data.verticalAlignment = GridData.FILL;
- data.horizontalAlignment = GridData.FILL;
- composite.setLayoutData(data);
-
- return composite;
- }
-
- protected void performDefaults() {
- _pathValueText.setText(getDefaultIvyconfURLForDisplay());
- _retreiveB.setSelection(false);
- _patternT.setText("");
- _acceptedTypesText.setText("[inherited]");
- _sourcesTypesText.setText("[inherited]");
- _javadocTypesText.setText("[inherited]");
- }
-
- private String getDefaultIvyconfURLForDisplay() {
- return "[inherited] "+IvyPlugin.getIvyconfURL();
- }
-
- public boolean performOk() {
- IvyPlugin.beginChanges();
- try {
- // store the value in the owner text field
- String text = _pathValueText.getText();
- if (text.startsWith("[inherited] ") || text.trim().length() == 0) {
- text = null;
- }
- IvyPlugin.setIvyconfURL(getJavaProject(), text);
-
- //retreive per project
- if(_retreiveB.getSelection()) {
- IvyPlugin.setRetreivePattern(getJavaProject(), _patternT.getText());
- } else {
- IvyPlugin.setRetreivePattern(getJavaProject(),"");
- }
-
- IvyPlugin.setAcceptedTypes(getJavaProject(), _acceptedTypesText.getText());
- IvyPlugin.setSourcesTypes(getJavaProject(), _sourcesTypesText.getText());
- IvyPlugin.setJavadocTypes(getJavaProject(), _javadocTypesText.getText());
- return true;
- } finally {
- IvyPlugin.commitChanges();
- }
- }
-
-}
\ No newline at end of file
+package org.apache.ivyde.eclipse.ui.properties;
+
+import java.io.File;
+import java.net.MalformedURLException;
+
+import org.apache.ivyde.eclipse.IvyPlugin;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.dialogs.PropertyPage;
+
+public class IvyProjectPropertyPage extends PropertyPage {
+
+ private static final String PATH_TITLE = "Ivy settings url:";
+
+ private static final String ACCEPTED_TYPES_TITLE = "Accepted types:";
+
+ private static final String SOURCES_TYPES_TITLE = "Sources types:";
+
+ private static final String JAVADOC_TYPES_TITLE = "Javadoc types:";
+
+ private Text _pathValueText;
+
+ private Button _retreiveB;
+
+ private Text _patternT;
+
+ private Text _acceptedTypesText;
+
+ private Text _sourcesTypesText;
+
+ private Text _javadocTypesText;
+
+ public IvyProjectPropertyPage() {
+ super();
+ }
+
+ private void addMainSection(Composite parent) {
+ Composite composite = createDefaultComposite(parent);
+
+ // Label for path field
+ Label pathLabel = new Label(composite, SWT.NONE);
+ pathLabel.setText(PATH_TITLE);
+
+ _pathValueText = new Text(composite, SWT.SINGLE | SWT.BORDER);
+ String ivyconfURL = IvyPlugin.getStrictIvyconfURL(getJavaProject());
+ if (ivyconfURL == null) {
+ ivyconfURL = getDefaultIvyconfURLForDisplay();
+ }
+ _pathValueText.setText(ivyconfURL);
+ _pathValueText.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true, false,
+ 2, 1));
+
+ Button btn = new Button(composite, SWT.NONE);
+ btn.setText("Browse");
+ btn.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ File f = getFile(new File("/"));
+ if (f != null) {
+ try {
+ _pathValueText.setText(f.toURL().toExternalForm());
+ } catch (MalformedURLException e1) {
+ }
+ }
+ }
+ });
+
+ new Label(composite, SWT.NONE); // space
+ Label explanation = new Label(composite, SWT.NONE);
+ explanation.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, 3,
+ 1));
+ explanation
+ .setText("The url where your ivysettings file can be found. \nUse 'default' to reference the default ivy settings. \nUse '[inherited]' to use your general eclipse setting.\nRelative paths are handled relative to the project. Example: 'file://./ivysettings.xml'.");
+ new Label(composite, SWT.NONE).setLayoutData(new GridData(GridData.FILL,
+ GridData.BEGINNING, false, false, 4, 1)); // space
+
+ Label acceptedTypesLabel = new Label(composite, SWT.NONE);
+ acceptedTypesLabel.setText(ACCEPTED_TYPES_TITLE);
+
+ _acceptedTypesText = new Text(composite, SWT.SINGLE | SWT.BORDER);
+ _acceptedTypesText.setText(IvyPlugin.getAcceptedTypesString(getJavaProject()));
+ _acceptedTypesText.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true,
+ false, 3, 1));
+
+ new Label(composite, SWT.NONE); // space
+ explanation = new Label(composite, SWT.NONE);
+ explanation.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, 3,
+ 1));
+ explanation
+ .setText("Comma separated list of artifact types to use in IvyDE Managed Dependencies Library.\nExample: jar, zip\nUse [inherited] to use your general eclise setting.");
+
+ Label sourcesTypesLabel = new Label(composite, SWT.NONE);
+ sourcesTypesLabel.setText(SOURCES_TYPES_TITLE);
+
+ _sourcesTypesText = new Text(composite, SWT.SINGLE | SWT.BORDER);
+ _sourcesTypesText.setText(IvyPlugin.getSourcesTypesString(getJavaProject()));
+ _sourcesTypesText
+ .setToolTipText("Example: source, src\nUse [inherited] to use your general eclise setting.");
+ _sourcesTypesText.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true,
+ false, 3, 1));
+
+ new Label(composite, SWT.NONE); // space
+ explanation = new Label(composite, SWT.NONE);
+ explanation.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, 3,
+ 1));
+ explanation.setText("Comma separated list of artifact types to be used as sources.");
+
+ Label javadocTypesLabel = new Label(composite, SWT.NONE);
+ javadocTypesLabel.setText(JAVADOC_TYPES_TITLE);
+
+ _javadocTypesText = new Text(composite, SWT.SINGLE | SWT.BORDER);
+ _javadocTypesText.setText(IvyPlugin.getJavadocTypesString(getJavaProject()));
+ _javadocTypesText
+ .setToolTipText("Example: javadoc\nUse [inherited] to use your general eclise setting.");
+ _javadocTypesText.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true,
+ false, 3, 1));
+
+ new Label(composite, SWT.NONE); // space
+ explanation = new Label(composite, SWT.NONE);
+ explanation.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, 3,
+ 1));
+ explanation.setText("Comma separated list of artifact types to be used as javadoc.");
+
+ new Label(composite, SWT.NONE).setLayoutData(new GridData(GridData.FILL,
+ GridData.BEGINNING, false, false, 4, 1)); // space
+
+ _retreiveB = new Button(composite, SWT.CHECK);
+ _retreiveB.setText("Do retrieve after resolve");
+ _retreiveB
+ .setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, 4, 1));
+
+ new Label(composite, SWT.NONE).setText("Pattern:");
+ _patternT = new Text(composite, SWT.SINGLE | SWT.BORDER);
+ _patternT.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true, false, 3, 1));
+ _retreiveB.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ _patternT.setEnabled(_retreiveB.getSelection());
+ }
+ });
+ _retreiveB.setSelection(IvyPlugin.shouldDoRetrieve(getJavaProject()));
+ _patternT.setEnabled(_retreiveB.getSelection());
+ _patternT.setText(IvyPlugin.getRetrievePatternHerited(getJavaProject()));
+
+ new Label(composite, SWT.NONE); // space
+ explanation = new Label(composite, SWT.NONE);
+ explanation.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, 3,
+ 1));
+ explanation
+ .setText("Example: lib/[conf]/[artifact].[ext]\nTo copy artifacts in folder named lib without revision by folder named like configurations\nUse [inherited] to use your general eclipse setting.");
+ new Label(composite, SWT.NONE).setLayoutData(new GridData(GridData.FILL,
+ GridData.BEGINNING, false, false, 4, 1)); // space
+ }
+
+ /**
+ * Try to get a JavaProject from the getElement() result. Throws a IllegalStateException if it
+ * can't succeed.
+ *
+ * @return
+ */
+ private IJavaProject getJavaProject() {
+ IAdaptable adaptable = getElement();
+ IJavaProject project = null;
+ if (adaptable instanceof IJavaProject) {
+ project = (IJavaProject) adaptable;
+ } else if (adaptable instanceof IProject) {
+ project = JavaCore.create((IProject) adaptable);
+ } else {
+ throw new IllegalStateException("Attempting a IProject element ! Not "
+ + adaptable.getClass().getName() + " element");
+ }
+ return project;
+ }
+
+ /**
+ * Helper to open the file chooser dialog.
+ *
+ * @param startingDirectory
+ * the directory to open the dialog on.
+ * @return File The File the user selected or <code>null</code> if they do not.
+ */
+ private File getFile(File startingDirectory) {
+
+ FileDialog dialog = new FileDialog(getShell(), SWT.OPEN);
+ if (startingDirectory != null)
+ dialog.setFileName(startingDirectory.getPath());
+ dialog.setFilterExtensions(new String[] {"*.xml", "*"});
+ String file = dialog.open();
+ if (file != null) {
+ file = file.trim();
+ if (file.length() > 0)
+ return new File(file);
+ }
+
+ return null;
+ }
+
+ /**
+ * @see PreferencePage#createContents(Composite)
+ */
+ protected Control createContents(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout(1, false);
+ composite.setLayout(layout);
+ GridData data = new GridData(GridData.FILL);
+ data.grabExcessHorizontalSpace = true;
+ composite.setLayoutData(data);
+
+ addMainSection(composite);
+ return composite;
+ }
+
+ private Composite createDefaultComposite(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NULL);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 4;
+ composite.setLayout(layout);
+
+ GridData data = new GridData();
+ data.grabExcessHorizontalSpace = true;
+ data.verticalAlignment = GridData.FILL;
+ data.horizontalAlignment = GridData.FILL;
+ composite.setLayoutData(data);
+
+ return composite;
+ }
+
+ protected void performDefaults() {
+ _pathValueText.setText(getDefaultIvyconfURLForDisplay());
+ _retreiveB.setSelection(false);
+ _patternT.setText("");
+ _acceptedTypesText.setText("[inherited]");
+ _sourcesTypesText.setText("[inherited]");
+ _javadocTypesText.setText("[inherited]");
+ }
+
+ private String getDefaultIvyconfURLForDisplay() {
+ return "[inherited] " + IvyPlugin.getIvyconfURL();
+ }
+
+ public boolean performOk() {
+ IvyPlugin.beginChanges();
+ try {
+ // store the value in the owner text field
+ String text = _pathValueText.getText();
+ if (text.startsWith("[inherited] ") || text.trim().length() == 0) {
+ text = null;
+ }
+ IvyPlugin.setIvyconfURL(getJavaProject(), text);
+
+ // retreive per project
+ if (_retreiveB.getSelection()) {
+ IvyPlugin.setRetreivePattern(getJavaProject(), _patternT.getText());
+ } else {
+ IvyPlugin.setRetreivePattern(getJavaProject(), "");
+ }
+
+ IvyPlugin.setAcceptedTypes(getJavaProject(), _acceptedTypesText.getText());
+ IvyPlugin.setSourcesTypes(getJavaProject(), _sourcesTypesText.getText());
+ IvyPlugin.setJavadocTypes(getJavaProject(), _javadocTypesText.getText());
+ return true;
+ } finally {
+ IvyPlugin.commitChanges();
+ }
+ }
+
+}
Propchange: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/properties/IvyProjectPropertyPage.java
------------------------------------------------------------------------------
svn:eol-style = native