You are viewing a plain text version of this content. The canonical link for it is here.
Posted to doxia-commits@maven.apache.org by vs...@apache.org on 2008/04/07 15:18:37 UTC

svn commit: r645502 [2/4] - in /maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui: ./ icons/ icons/dtool16/ icons/etool16/ lib/ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache...

Added: maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/AbstractLinkAction.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/AbstractLinkAction.java?rev=645502&view=auto
==============================================================================
--- maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/AbstractLinkAction.java (added)
+++ maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/AbstractLinkAction.java Mon Apr  7 06:18:18 2008
@@ -0,0 +1,120 @@
+package org.apache.maven.doxia.ide.eclipse.common.ui.actions;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.doxia.ide.eclipse.common.ui.CommonPlugin;
+import org.apache.maven.doxia.ide.eclipse.common.ui.CommonPluginMessages;
+import org.apache.maven.doxia.ide.eclipse.common.ui.dialogs.AddLinkDialog;
+import org.apache.maven.doxia.ide.eclipse.common.ui.dialogs.AddLinkDialog.Link;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.TextSelection;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.editors.text.TextEditor;
+import org.eclipse.ui.texteditor.ITextEditor;
+import org.eclipse.ui.texteditor.TextEditorAction;
+
+/**
+ * Abstract <code>link</code> action.
+ *
+ * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
+ * @version $Id$
+ * @since 1.0
+ * @see IActionConstants#LINK_ACTION for the action Key
+ */
+public abstract class AbstractLinkAction
+    extends TextEditorAction
+{
+    public AbstractLinkAction( ITextEditor editor )
+    {
+        super( CommonPluginMessages.getResourceBundle(), "Link.", editor );
+
+        setId( IActionConstants.LINK_ACTION );
+
+        ImageRegistry imageRegistry = CommonPlugin.getDefault().getImageRegistry();
+        setImageDescriptor( imageRegistry.getDescriptor( CommonPlugin.IMG_LINK ) );
+        // TODO activate me!
+        setDisabledImageDescriptor( imageRegistry.getDescriptor( CommonPlugin.IMG_LINK_DISABLED ) );
+    }
+
+    @Override
+    public void run()
+    {
+        AddLinkDialog dialog = new AddLinkDialog( Display.getCurrent().getActiveShell() );
+        dialog.open();
+        if ( dialog.getReturnCode() == Window.OK )
+        {
+            String linkURL = dialog.getLink().getURL();
+            if ( linkURL.length() > 0 )
+            {
+                addLink( dialog.getLink() );
+            }
+        }
+    }
+
+    // ----------------------------------------------------------------------
+    // Protected methods
+    // ----------------------------------------------------------------------
+
+    /**
+     * @param link
+     * @return
+     */
+    protected abstract String generateLink( Link link );
+
+    // ----------------------------------------------------------------------
+    // Private methods
+    // ----------------------------------------------------------------------
+
+    /**
+     * Apply link
+     */
+    private void addLink( Link link )
+    {
+        Assert.isTrue( TextEditor.class.isAssignableFrom( getTextEditor().getClass() ),
+                       "getTextEditor() is not an instance of AbstractMultiPageEditorPart" );
+
+        ISelection selection = getTextEditor().getEditorSite().getSelectionProvider().getSelection();
+
+        Assert.isTrue( TextSelection.class.isAssignableFrom( selection.getClass() ),
+                       "selection is not and instance of TextSelection" );
+        TextSelection selectedText = (TextSelection) selection;
+
+        int iCursorPosition = selectedText.getOffset();
+
+        IDocument doc = getTextEditor().getDocumentProvider().getDocument( getTextEditor().getEditorInput() );
+
+        if ( doc != null )
+        {
+            try
+            {
+                doc.replace( iCursorPosition, 0, generateLink( link ) );
+            }
+            catch ( BadLocationException e )
+            {
+                CommonPlugin.logError( "BadLocationException: " + e.getMessage(), e, true );
+            }
+        }
+    }
+}

Propchange: maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/AbstractLinkAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/AbstractLinkAction.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/AbstractMonospacedAction.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/AbstractMonospacedAction.java?rev=645502&view=auto
==============================================================================
--- maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/AbstractMonospacedAction.java (added)
+++ maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/AbstractMonospacedAction.java Mon Apr  7 06:18:18 2008
@@ -0,0 +1,54 @@
+package org.apache.maven.doxia.ide.eclipse.common.ui.actions;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.doxia.ide.eclipse.common.ui.CommonPlugin;
+import org.apache.maven.doxia.ide.eclipse.common.ui.CommonPluginMessages;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.ui.texteditor.ITextEditor;
+
+/**
+ * Abstract <code>monospaced</code> action.
+ *
+ * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
+ * @version $Id$
+ * @since 1.0
+ * @see IActionConstants#MONOSPACED_ACTION for the action Key
+ */
+public abstract class AbstractMonospacedAction
+    extends AbstractStyleAction
+{
+    /**
+     * Default constructor
+     *
+     * @param editor
+     */
+    public AbstractMonospacedAction( ITextEditor editor )
+    {
+        super( CommonPluginMessages.getResourceBundle(), "Monospaced.", editor );
+
+        setId( IActionConstants.MONOSPACED_ACTION );
+
+        ImageRegistry imageRegistry = CommonPlugin.getDefault().getImageRegistry();
+        setImageDescriptor( imageRegistry.getDescriptor( CommonPlugin.IMG_MONOSPACED ) );
+        // TODO activate me!
+        setDisabledImageDescriptor( imageRegistry.getDescriptor( CommonPlugin.IMG_MONOSPACED_DISABLED ) );
+    }
+}

Propchange: maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/AbstractMonospacedAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/AbstractMonospacedAction.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/AbstractStyleAction.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/AbstractStyleAction.java?rev=645502&view=auto
==============================================================================
--- maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/AbstractStyleAction.java (added)
+++ maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/AbstractStyleAction.java Mon Apr  7 06:18:18 2008
@@ -0,0 +1,121 @@
+package org.apache.maven.doxia.ide.eclipse.common.ui.actions;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.ResourceBundle;
+
+import org.apache.maven.doxia.ide.eclipse.common.ui.CommonPlugin;
+import org.codehaus.plexus.util.StringUtils;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.TextSelection;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.editors.text.TextEditor;
+import org.eclipse.ui.texteditor.ITextEditor;
+import org.eclipse.ui.texteditor.TextEditorAction;
+
+/**
+ * Abstract class for style actions.
+ *
+ * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
+ * @version $Id$
+ * @since 1.0
+ */
+public abstract class AbstractStyleAction
+    extends TextEditorAction
+{
+    public AbstractStyleAction( ResourceBundle bundle, String prefix, ITextEditor editor )
+    {
+        super( bundle, prefix, editor );
+
+        Assert.isNotNull( getStartMarkup(), "getStartMarkup() should be defined" );
+        Assert.isNotNull( getEndMarkup(), "getEndMarkup() should be defined" );
+    }
+
+    @Override
+    public void run()
+    {
+        addStyle();
+    }
+
+    /**
+     * @return a start markup for the Doxia implementation.
+     */
+    public abstract String getStartMarkup();
+
+    /**
+     * @return a end markup for the Doxia implementation.
+     */
+    public abstract String getEndMarkup();
+
+    // ----------------------------------------------------------------------
+    // Protected methods
+    // ----------------------------------------------------------------------
+
+    /**
+     * @param link
+     * @return
+     */
+    protected String generateStyle( String strSelectedText )
+    {
+        return getStartMarkup() + strSelectedText + getEndMarkup();
+    }
+
+    // ----------------------------------------------------------------------
+    // Private methods
+    // ----------------------------------------------------------------------
+
+    /**
+     * Apply style
+     */
+    private void addStyle()
+    {
+        Assert.isTrue( TextEditor.class.isAssignableFrom( getTextEditor().getClass() ),
+                       "getTextEditor() is not an instance of AbstractMultiPageEditorPart" );
+
+        ISelection selection = getTextEditor().getEditorSite().getSelectionProvider().getSelection();
+
+        Assert.isTrue( TextSelection.class.isAssignableFrom( selection.getClass() ),
+                       "selection is not and instance of TextSelection" );
+        TextSelection selectedText = (TextSelection) selection;
+
+        String strSelectedText = selectedText.getText();
+        if ( StringUtils.isEmpty( strSelectedText ) )
+        {
+            return;
+        }
+
+        int iCursorPosition = selectedText.getOffset();
+        IDocument doc = getTextEditor().getDocumentProvider().getDocument( getTextEditor().getEditorInput() );
+
+        if ( doc != null )
+        {
+            try
+            {
+                doc.replace( iCursorPosition, selectedText.getLength(), generateStyle( strSelectedText ) );
+            }
+            catch ( BadLocationException e )
+            {
+                CommonPlugin.logError( "BadLocationException: " + e.getMessage(), e, true );
+            }
+        }
+    }
+}

Propchange: maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/AbstractStyleAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/AbstractStyleAction.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/AbstractTableAction.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/AbstractTableAction.java?rev=645502&view=auto
==============================================================================
--- maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/AbstractTableAction.java (added)
+++ maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/AbstractTableAction.java Mon Apr  7 06:18:18 2008
@@ -0,0 +1,142 @@
+package org.apache.maven.doxia.ide.eclipse.common.ui.actions;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.doxia.ide.eclipse.common.ui.CommonPlugin;
+import org.apache.maven.doxia.ide.eclipse.common.ui.CommonPluginMessages;
+import org.apache.maven.doxia.ide.eclipse.common.ui.dialogs.AddTableDialog;
+import org.apache.maven.doxia.ide.eclipse.common.ui.dialogs.AddTableDialog.Table;
+import org.apache.maven.doxia.markup.Markup;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.TextSelection;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.editors.text.TextEditor;
+import org.eclipse.ui.texteditor.ITextEditor;
+import org.eclipse.ui.texteditor.TextEditorAction;
+
+/**
+ * Abstract <code>table</code> action.
+ *
+ * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
+ * @version $Id$
+ * @since 1.0
+ * @see IActionConstants#TABLE_ACTION for the action Key
+ */
+public abstract class AbstractTableAction
+    extends TextEditorAction
+{
+    /** Default text in the generated cell */
+    protected static final String DEFAULT_CELL_TEXT = "cell";
+
+    /**
+     * Default constructor.
+     *
+     * @param editor
+     */
+    public AbstractTableAction( ITextEditor editor )
+    {
+        super( CommonPluginMessages.getResourceBundle(), "Table.", editor );
+
+        setId( IActionConstants.TABLE_ACTION );
+
+        ImageRegistry imageRegistry = CommonPlugin.getDefault().getImageRegistry();
+        setImageDescriptor( imageRegistry.getDescriptor( CommonPlugin.IMG_TABLE ) );
+        // TODO activate me!
+        setDisabledImageDescriptor( imageRegistry.getDescriptor( CommonPlugin.IMG_TABLE_DISABLED ) );
+    }
+
+    @Override
+    public void run()
+    {
+        AddTableDialog dialog = new AddTableDialog( Display.getCurrent().getActiveShell() );
+        dialog.open();
+        if ( dialog.getReturnCode() == Window.OK )
+        {
+            Table table = dialog.getTable();
+
+            int rows = table.getRows();
+            int cols = table.getColumns();
+            if ( rows > 0 && cols > 0 )
+            {
+                addTable( table );
+            }
+        }
+    }
+
+    // ----------------------------------------------------------------------
+    // Protected methods
+    // ----------------------------------------------------------------------
+
+    /**
+     * @param link
+     * @return
+     */
+    protected abstract String generateTable( Table table );
+
+    // ----------------------------------------------------------------------
+    // Private methods
+    // ----------------------------------------------------------------------
+
+    /**
+     * Apply table
+     */
+    private void addTable( Table table )
+    {
+        Assert.isTrue( TextEditor.class.isAssignableFrom( getTextEditor().getClass() ),
+                       "getTextEditor() is not an instance of AbstractMultiPageEditorPart" );
+
+        ISelection selection = getTextEditor().getEditorSite().getSelectionProvider().getSelection();
+
+        Assert.isTrue( TextSelection.class.isAssignableFrom( selection.getClass() ),
+                       "selection is not and instance of TextSelection" );
+        TextSelection selectedText = (TextSelection) selection;
+
+        int iCursorPosition = selectedText.getOffset();
+
+        IDocument doc = getTextEditor().getDocumentProvider().getDocument( getTextEditor().getEditorInput() );
+
+        if ( doc != null )
+        {
+            try
+            {
+                int iNextLinePosition = doc.getLineOffset( selectedText.getStartLine() )
+                    + doc.getLineLength( selectedText.getStartLine() );
+
+                if ( iCursorPosition + 1 != iNextLinePosition || iCursorPosition != iNextLinePosition )
+                {
+                    doc.replace( iNextLinePosition, 0, Markup.EOL + generateTable( table ) + Markup.EOL );
+                }
+                else
+                {
+                    doc.replace( iCursorPosition, 0, generateTable( table ) );
+                }
+            }
+            catch ( BadLocationException e )
+            {
+                CommonPlugin.logError( "BadLocationException: " + e.getMessage(), e, true );
+            }
+        }
+    }
+}

Propchange: maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/AbstractTableAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/AbstractTableAction.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/BoldActionDelegate.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/BoldActionDelegate.java?rev=645502&view=auto
==============================================================================
--- maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/BoldActionDelegate.java (added)
+++ maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/BoldActionDelegate.java Mon Apr  7 06:18:18 2008
@@ -0,0 +1,57 @@
+package org.apache.maven.doxia.ide.eclipse.common.ui.actions;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.doxia.ide.eclipse.common.ui.CommonPlugin;
+
+/**
+ * Delegates to <code>bold</code> action.
+ *
+ * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
+ * @version $Id$
+ * @since 1.0
+ * @see IActionConstants#BOLD_ACTION for the action Key
+ */
+public class BoldActionDelegate
+    extends AbstractActionDelegate
+{
+    public BoldActionDelegate()
+    {
+        super();
+    }
+
+    @Override
+    public String getActionId()
+    {
+        return IActionConstants.BOLD_ACTION;
+    }
+
+    @Override
+    public String getBundleKey()
+    {
+        return "bold";
+    }
+
+    @Override
+    public String[] getImageDescriptorKey()
+    {
+        return new String[] { CommonPlugin.IMG_BOLD, CommonPlugin.IMG_BOLD_DISABLED };
+    }
+}

Propchange: maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/BoldActionDelegate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/BoldActionDelegate.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/IActionConstants.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/IActionConstants.java?rev=645502&view=auto
==============================================================================
--- maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/IActionConstants.java (added)
+++ maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/IActionConstants.java Mon Apr  7 06:18:18 2008
@@ -0,0 +1,69 @@
+package org.apache.maven.doxia.ide.eclipse.common.ui.actions;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.eclipse.ui.texteditor.ITextEditorActionConstants;
+
+/**
+ * Doxia key actions.
+ *
+ * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
+ * @version $Id$
+ * @since 1.0
+ */
+public interface IActionConstants
+    extends ITextEditorActionConstants
+{
+    /**
+     * Name of the standard global action "Bold"
+     * (value <code>"org.apache.maven.doxia.ide.eclipse.common.ui.actions.BoldAction"</code>).
+     */
+    String BOLD_ACTION = "org.apache.maven.doxia.ide.eclipse.common.ui.actions.BoldAction";
+
+    /**
+     * Name of the standard global action "Content Assist"
+     * (value <code>"org.apache.maven.doxia.ide.eclipse.common.ui.actions.ContentAssistAction"</code>).
+     */
+    String CONTENT_ASSIST_ACTION = "org.apache.maven.doxia.ide.eclipse.common.ui.actions.ContentAssistAction";
+
+    /**
+     * Name of the standard global action "Italic"
+     * (value <code>"org.apache.maven.doxia.ide.eclipse.common.ui.actions.ItalicAction"</code>).
+     */
+    String ITALIC_ACTION = "org.apache.maven.doxia.ide.eclipse.common.ui.actions.ItalicAction";
+
+    /**
+     * Name of the standard global action "link"
+     * (value <code>"org.apache.maven.doxia.ide.eclipse.common.ui.actions.LinkAction"</code>).
+     */
+    String LINK_ACTION = "org.apache.maven.doxia.ide.eclipse.common.ui.actions.LinkAction";
+
+    /**
+     * Name of the standard global action "Monospaced"
+     * (value <code>"org.apache.maven.doxia.ide.eclipse.common.ui.actions.MonospacedAction"</code>).
+     */
+    String MONOSPACED_ACTION = "org.apache.maven.doxia.ide.eclipse.common.ui.actions.MonospacedAction";
+
+    /**
+     * Name of the standard global action "table"
+     * (value <code>"org.apache.maven.doxia.ide.eclipse.common.ui.actions.TableAction"</code>).
+     */
+    String TABLE_ACTION = "org.apache.maven.doxia.ide.eclipse.common.ui.actions.TableAction";
+}

Propchange: maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/IActionConstants.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/IActionConstants.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/ItalicActionDelegate.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/ItalicActionDelegate.java?rev=645502&view=auto
==============================================================================
--- maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/ItalicActionDelegate.java (added)
+++ maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/ItalicActionDelegate.java Mon Apr  7 06:18:18 2008
@@ -0,0 +1,57 @@
+package org.apache.maven.doxia.ide.eclipse.common.ui.actions;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.doxia.ide.eclipse.common.ui.CommonPlugin;
+
+/**
+ * Delegates to <code>italic</code> action.
+ *
+ * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
+ * @version $Id$
+ * @since 1.0
+ * @see IActionConstants#ITALIC_ACTION for the action Key
+ */
+public class ItalicActionDelegate
+    extends AbstractActionDelegate
+{
+    public ItalicActionDelegate()
+    {
+        super();
+    }
+
+    @Override
+    public String getActionId()
+    {
+        return IActionConstants.ITALIC_ACTION;
+    }
+
+    @Override
+    public String getBundleKey()
+    {
+        return "italic";
+    }
+
+    @Override
+    public String[] getImageDescriptorKey()
+    {
+        return new String[] { CommonPlugin.IMG_ITALIC, CommonPlugin.IMG_ITALIC_DISABLED };
+    }
+}

Propchange: maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/ItalicActionDelegate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/ItalicActionDelegate.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/LinkActionDelegate.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/LinkActionDelegate.java?rev=645502&view=auto
==============================================================================
--- maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/LinkActionDelegate.java (added)
+++ maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/LinkActionDelegate.java Mon Apr  7 06:18:18 2008
@@ -0,0 +1,57 @@
+package org.apache.maven.doxia.ide.eclipse.common.ui.actions;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.doxia.ide.eclipse.common.ui.CommonPlugin;
+
+/**
+ * Delegates to <code>link</code> action.
+ *
+ * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
+ * @version $Id$
+ * @since 1.0
+ * @see IActionConstants#LINK_ACTION for the action Key
+ */
+public class LinkActionDelegate
+    extends AbstractActionDelegate
+{
+    public LinkActionDelegate()
+    {
+        super();
+    }
+
+    @Override
+    public String getActionId()
+    {
+        return IActionConstants.LINK_ACTION;
+    }
+
+    @Override
+    public String getBundleKey()
+    {
+        return "link";
+    }
+
+    @Override
+    public String[] getImageDescriptorKey()
+    {
+        return new String[] { CommonPlugin.IMG_LINK, CommonPlugin.IMG_LINK_DISABLED };
+    }
+}

Propchange: maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/LinkActionDelegate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/LinkActionDelegate.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/MonospacedActionDelegate.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/MonospacedActionDelegate.java?rev=645502&view=auto
==============================================================================
--- maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/MonospacedActionDelegate.java (added)
+++ maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/MonospacedActionDelegate.java Mon Apr  7 06:18:18 2008
@@ -0,0 +1,57 @@
+package org.apache.maven.doxia.ide.eclipse.common.ui.actions;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.doxia.ide.eclipse.common.ui.CommonPlugin;
+
+/**
+ * Delegates to <code>monospaced</code> action.
+ *
+ * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
+ * @version $Id$
+ * @since 1.0
+ * @see IActionConstants#MONOSPACED_ACTION for the action Key
+ */
+public class MonospacedActionDelegate
+    extends AbstractActionDelegate
+{
+    public MonospacedActionDelegate()
+    {
+        super();
+    }
+
+    @Override
+    public String getActionId()
+    {
+        return IActionConstants.MONOSPACED_ACTION;
+    }
+
+    @Override
+    public String getBundleKey()
+    {
+        return "monospaced";
+    }
+
+    @Override
+    public String[] getImageDescriptorKey()
+    {
+        return new String[] { CommonPlugin.IMG_MONOSPACED, CommonPlugin.IMG_MONOSPACED_DISABLED };
+    }
+}

Propchange: maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/MonospacedActionDelegate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/MonospacedActionDelegate.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/TableActionDelegate.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/TableActionDelegate.java?rev=645502&view=auto
==============================================================================
--- maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/TableActionDelegate.java (added)
+++ maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/TableActionDelegate.java Mon Apr  7 06:18:18 2008
@@ -0,0 +1,57 @@
+package org.apache.maven.doxia.ide.eclipse.common.ui.actions;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.doxia.ide.eclipse.common.ui.CommonPlugin;
+
+/**
+ * Delegates to <code>table</code> action.
+ *
+ * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
+ * @version $Id$
+ * @since 1.0
+ * @see IActionConstants#TABLE_ACTION for the action Key
+ */
+public class TableActionDelegate
+    extends AbstractActionDelegate
+{
+    public TableActionDelegate()
+    {
+        super();
+    }
+
+    @Override
+    public String getActionId()
+    {
+        return IActionConstants.TABLE_ACTION;
+    }
+
+    @Override
+    public String getBundleKey()
+    {
+        return "table";
+    }
+
+    @Override
+    public String[] getImageDescriptorKey()
+    {
+        return new String[] { CommonPlugin.IMG_TABLE, CommonPlugin.IMG_TABLE_DISABLED };
+    }
+}

Propchange: maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/TableActionDelegate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/actions/TableActionDelegate.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/composites/BrowserComposite.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/composites/BrowserComposite.java?rev=645502&view=auto
==============================================================================
--- maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/composites/BrowserComposite.java (added)
+++ maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/composites/BrowserComposite.java Mon Apr  7 06:18:18 2008
@@ -0,0 +1,440 @@
+package org.apache.maven.doxia.ide.eclipse.common.ui.composites;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.File;
+import java.io.IOException;
+import java.io.Writer;
+
+import javax.swing.text.html.HTML.Tag;
+
+import org.apache.maven.doxia.ide.eclipse.common.ui.CommonPlugin;
+import org.apache.maven.doxia.ide.eclipse.common.ui.CommonPluginMessages;
+import org.apache.maven.doxia.ide.eclipse.common.ui.DoxiaWrapper;
+import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.util.IOUtil;
+import org.codehaus.plexus.util.StringUtils;
+import org.codehaus.plexus.util.WriterFactory;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.ContributionManager;
+import org.eclipse.jface.action.IStatusLineManager;
+import org.eclipse.jface.action.ToolBarManager;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.SWTError;
+import org.eclipse.swt.browser.Browser;
+import org.eclipse.swt.browser.LocationAdapter;
+import org.eclipse.swt.browser.LocationEvent;
+import org.eclipse.swt.browser.ProgressAdapter;
+import org.eclipse.swt.browser.ProgressEvent;
+import org.eclipse.swt.browser.StatusTextEvent;
+import org.eclipse.swt.browser.StatusTextListener;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.ui.IActionBars;
+
+/**
+ * This composite creates a browser with actions like back, forward, stop and refresh.
+ *
+ * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
+ * @version $Id$
+ * @since 1.0
+ */
+public class BrowserComposite
+    extends Composite
+{
+    private static final String LS = System.getProperty( "line.separator" );
+
+    /** The browser widget used for the preview */
+    private Browser browser;
+
+    /** The file used for the preview */
+    private IFile file;
+
+    /** The format used for the preview */
+    private String format;
+
+    /** The back action */
+    private Action back;
+
+    /** The forward action */
+    private Action forward;
+
+    /** The stop action */
+    private Action stop;
+
+    /**
+     * Default constructor.
+     *
+     * @param parent
+     * @param style
+     * @param actionBars
+     * @param file
+     * @param format
+     */
+    public BrowserComposite( Composite parent, int style, IActionBars actionBars, IFile file, String format )
+    {
+        super( parent, style );
+
+        this.file = file;
+        this.format = format;
+
+        init( actionBars );
+    }
+
+    /**
+     * Generates the content of the view with Doxia.
+     */
+    public void convert()
+    {
+        setText( DoxiaWrapper.convert( file, format ) );
+    }
+
+    // ----------------------------------------------------------------------
+    // Private methods
+    // ----------------------------------------------------------------------
+
+    /**
+     * Init the actionBars
+     *
+     * @param actionBars
+     */
+    private void init( final IActionBars actionBars )
+    {
+        try
+        {
+            browser = new Browser( this, SWT.NONE );
+        }
+        catch ( SWTError e )
+        {
+            setLayout( new FillLayout() );
+            Label label = new Label( this, SWT.CENTER | SWT.WRAP );
+            label.setText( getString( "notCreated" ) );
+            layout( true );
+            return;
+        }
+
+        FormLayout formLayout = new FormLayout();
+        formLayout.marginHeight = 3;
+        formLayout.marginWidth = 3;
+        setLayout( formLayout );
+        ToolBarManager manager = new ToolBarManager( SWT.FLAT );
+
+        createBrowserToolBar( manager );
+
+        GridData gd = new GridData();
+        gd.grabExcessHorizontalSpace = true;
+        gd.verticalAlignment = GridData.CENTER;
+        gd.horizontalAlignment = GridData.FILL;
+
+        ToolBar toolBar = manager.createControl( this );
+        FormData data = new FormData();
+        toolBar.setLayoutData( data );
+
+        data = new FormData();
+        data.left = new FormAttachment( 0, 0 );
+        data.right = new FormAttachment( 100, 0 );
+        data.top = new FormAttachment( toolBar, 0, SWT.DEFAULT );
+        data.bottom = new FormAttachment( 100, 0 );
+
+        browser.setLayoutData( data );
+        browser.addProgressListener( new ProgressAdapter()
+        {
+            IProgressMonitor monitor = actionBars.getStatusLineManager().getProgressMonitor();
+
+            boolean working = false;
+
+            int workedSoFar;
+
+            /** {@inheritDoc} */
+            public void changed( ProgressEvent event )
+            {
+                if ( event.total == 0 )
+                {
+                    return;
+                }
+                if ( !working )
+                {
+                    if ( event.current == event.total )
+                    {
+                        return;
+                    }
+                    monitor.beginTask( "", event.total );
+                    workedSoFar = 0;
+                    working = true;
+                    stop.setEnabled( true );
+                }
+
+                monitor.worked( event.current - workedSoFar );
+                workedSoFar = event.current;
+            }
+
+            /** {@inheritDoc} */
+            public void completed( ProgressEvent event )
+            {
+                monitor.done();
+                working = false;
+                stop.setEnabled( false );
+
+                updateNavigationStatus();
+            }
+        } );
+        browser.addStatusTextListener( new StatusTextListener()
+        {
+            IStatusLineManager status = actionBars.getStatusLineManager();
+
+            /** {@inheritDoc} */
+            public void changed( StatusTextEvent event )
+            {
+                status.setMessage( event.text );
+            }
+        } );
+        browser.addLocationListener( new LocationAdapter()
+        {
+            /** {@inheritDoc} */
+            public void changed( LocationEvent event )
+            {
+                updateNavigationStatus();
+            }
+        } );
+    }
+
+    /**
+     * @param manager
+     */
+    private void createBrowserToolBar( ContributionManager manager )
+    {
+        back = new Action()
+        {
+            /** {@inheritDoc} */
+            public void run()
+            {
+                if ( browser.back() )
+                {
+                    updateNavigationStatus();
+                }
+            }
+        };
+        back.setText( getString( "back.label" ) );
+        back.setToolTipText( getString( "back.label" ) );
+        ImageRegistry imageRegistry = CommonPlugin.getDefault().getImageRegistry();
+        back.setImageDescriptor( imageRegistry.getDescriptor( CommonPlugin.IMG_BROWSER_BACK ) );
+        back.setEnabled( false );
+        manager.add( back );
+
+        forward = new Action()
+        {
+            /** {@inheritDoc} */
+            public void run()
+            {
+                if ( browser.forward() )
+                {
+                    updateNavigationStatus();
+                }
+            }
+        };
+        forward.setText( getString( "forward.label" ) );
+        forward.setToolTipText( getString( "forward.label" ) );
+        forward.setImageDescriptor( imageRegistry.getDescriptor( CommonPlugin.IMG_BROWSER_FORWARD ) );
+        forward.setEnabled( false );
+        manager.add( forward );
+
+        stop = new Action()
+        {
+            /** {@inheritDoc} */
+            public void run()
+            {
+                browser.stop();
+            }
+        };
+        stop.setText( getString( "stop.label" ) );
+        stop.setToolTipText( getString( "stop.label" ) );
+        stop.setEnabled( false );
+        stop.setImageDescriptor( imageRegistry.getDescriptor( CommonPlugin.IMG_BROWSER_STOP ) );
+        manager.add( stop );
+
+        Action refresh = new Action()
+        {
+            /** {@inheritDoc} */
+            public void run()
+            {
+                browser.refresh();
+            }
+        };
+        refresh.setText( getString( "refresh.label" ) );
+        refresh.setToolTipText( getString( "refresh.label" ) );
+        refresh.setImageDescriptor( imageRegistry.getDescriptor( CommonPlugin.IMG_BROWSER_REFRESH ) );
+        manager.add( refresh );
+        refresh.setEnabled( true );
+        manager.update( false );
+    }
+
+    /**
+     * @param string
+     */
+    private void setText( String text )
+    {
+        int oldHeight = getClientScrollTop();
+
+        // small workaround to "remember" scrolling
+        text = StringUtils.replace( text, "</head>", getScriptTag() + "</head>" );
+        text = StringUtils.replace( text, "<body>", "<body onload=\"setScrollTop(" + oldHeight + ")\">" );
+
+        // Using setUrl() since setText() could be buggy for anchor
+        // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=117108
+        File generatedHtml = FileUtils.createTempFile( "doxia_", ".html", null );
+        generatedHtml.deleteOnExit();
+        Writer w = null;
+        try
+        {
+            w = WriterFactory.newPlatformWriter( generatedHtml );
+
+            w.write( text );
+        }
+        catch ( IOException e )
+        {
+            String msg = ( StringUtils.isEmpty( e.getMessage() ) ? e.getClass().getName() : e.getMessage() );
+
+            CommonPlugin.logError( "IOException: " + msg, e, true );
+
+            browser.setText( "IOException: " + msg );
+            return;
+        }
+        finally
+        {
+            IOUtil.close( w );
+        }
+
+        browser.setUrl( generatedHtml.toURI().toString() );
+
+        updateNavigationStatus();
+    }
+
+    private void updateNavigationStatus()
+    {
+        back.setEnabled( browser.isBackEnabled() );
+        forward.setEnabled( browser.isForwardEnabled() );
+    }
+
+    /**
+     * Communicates with the client <code>window.status</code> to get the current scrollTop.
+     *
+     * @return the browser client scrollTop
+     */
+    private int getClientScrollTop()
+    {
+        final String STATUS_QUERY = "statusQuery";
+
+        browser.addStatusTextListener( new StatusTextListener()
+        {
+            /** {@inheritDoc} */
+            public void changed( StatusTextEvent event )
+            {
+                browser.setData( STATUS_QUERY, event.text );
+            }
+        } );
+
+        browser.execute( "window.status=getScrollTop()" );
+
+        try
+        {
+            return Integer.valueOf( (String) browser.getData( STATUS_QUERY ) ).intValue();
+        }
+        catch ( NumberFormatException e )
+        {
+            return 0;
+        }
+    }
+
+    // ----------------------------------------------------------------------
+    // Private methods
+    // ----------------------------------------------------------------------
+
+    /**
+     * @return HTML script definition
+     */
+    private static String getScriptTag()
+    {
+        StringBuffer sb = new StringBuffer();
+
+        sb.append( "<" + Tag.SCRIPT.toString() + ">" ).append( LS );
+        sb.append( getScrollTopScriptGetter() ).append( LS );
+        sb.append( getScrollTopScriptSetter() ).append( LS );
+        sb.append( "</" + Tag.SCRIPT.toString() + ">" ).append( LS );
+
+        return sb.toString();
+    }
+
+    /**
+     * @return javascript getScrollTop() function
+     */
+    private static String getScrollTopScriptGetter()
+    {
+        StringBuffer sb = new StringBuffer();
+
+        sb.append( "function getScrollTop() {" ).append( LS );
+        sb.append( "  var scrOfY = 0;" ).append( LS );
+        sb.append( "  if( typeof( window.pageYOffset ) == 'number' ) {" ).append( LS );
+        sb.append( "    //Netscape compliant" ).append( LS );
+        sb.append( "    scrOfY = window.pageYOffset;" ).append( LS );
+        sb.append( "  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {" )
+            .append( LS );
+        sb.append( "    //DOM compliant" ).append( LS );
+        sb.append( "    scrOfY = document.body.scrollTop;" ).append( LS );
+        sb.append(
+                   "  } else if( document.documentElement && "
+                       + "( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {" )
+            .append( LS );
+        sb.append( "    //IE6 standards compliant mode" ).append( LS );
+        sb.append( "    scrOfY = document.documentElement.scrollTop;" ).append( LS );
+        sb.append( "  }" ).append( LS );
+        sb.append( "  return scrOfY;" ).append( LS );
+        sb.append( "}" ).append( LS );
+
+        return sb.toString();
+    }
+
+    /**
+     * @return javascript setScrollTop() function
+     */
+    private static String getScrollTopScriptSetter()
+    {
+        StringBuffer sb = new StringBuffer();
+
+        sb.append( "function setScrollTop(y) {" ).append( LS );
+        sb.append( "  window.scrollTo(0, y);" ).append( LS );
+        sb.append( "}" ).append( LS );
+
+        return sb.toString();
+    }
+
+    private static String getString( String subkey )
+    {
+        return CommonPluginMessages.getString( "BrowserComposite." + subkey );
+    }
+}

Propchange: maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/composites/BrowserComposite.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/composites/BrowserComposite.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/contentassist/AbstractContentAssistProcessor.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/contentassist/AbstractContentAssistProcessor.java?rev=645502&view=auto
==============================================================================
--- maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/contentassist/AbstractContentAssistProcessor.java (added)
+++ maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/contentassist/AbstractContentAssistProcessor.java Mon Apr  7 06:18:18 2008
@@ -0,0 +1,235 @@
+package org.apache.maven.doxia.ide.eclipse.common.ui.contentassist;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.maven.doxia.ide.eclipse.common.ui.CommonPlugin;
+import org.codehaus.plexus.util.StringUtils;
+import org.eclipse.core.runtime.Assert;
+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.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.Image;
+
+/**
+ * Abstract class for the content assist processor.
+ *
+ * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
+ * @version $Id$
+ * @since 1.0
+ */
+public abstract class AbstractContentAssistProcessor
+    implements IContentAssistProcessor
+{
+    private final IContextInformation[] NO_CONTEXTS = new IContextInformation[0];
+
+    /**
+     * Default constructor.
+     */
+    public AbstractContentAssistProcessor()
+    {
+        super();
+
+        Assert.isNotNull( getStartMarkups(), "getStartMarkups() should be defined" );
+        Assert.isNotNull( getEndMarkups(), "getEndMarkups() should be defined" );
+        Assert.isNotNull( getImageMarkups(), "getImageMarkups() should be defined" );
+        if ( ( getStartMarkups().length != getEndMarkups().length )
+            && ( getStartMarkups().length != getImageMarkups().length ) )
+        {
+            Assert.isTrue( true, "getStartMarkups(), getEndMarkups(), getImageMarkups() have not the same size" );
+        }
+    }
+
+    /** {@inheritDoc} */
+    public ICompletionProposal[] computeCompletionProposals( ITextViewer viewer, int offset )
+    {
+        IDocument document = viewer.getDocument();
+
+        String prefix = lastWord( document, offset );
+        String startTag = getStartTag( document, offset, prefix );
+        List<CompletionProposal> result = new ArrayList<CompletionProposal>();
+
+        System.out.println( "prefix" + prefix );
+        System.out.println( "startTag" + startTag );
+
+        if ( startTag == null )
+        {
+            for ( int i = 0; i < getStartMarkups().length; i++ )
+            {
+                result.add( new CompletionProposal( prefix + getStartMarkups()[i], offset - prefix.length(), prefix
+                    .length(), prefix.length() + getStartMarkups()[i].length(), getImageMarkups()[i],
+                                                    getStartMarkups()[i], null, null ) );
+            }
+        }
+        else
+        {
+            // Autocomplete for closing tags
+            int closingTagId = -1;
+            for ( int i = 0; i < getStartMarkups().length; i++ )
+            {
+                if ( getStartMarkups()[i].equals( startTag ) )
+                {
+                    closingTagId = i;
+                }
+            }
+
+            if ( closingTagId != -1 )
+            {
+                result.add( new CompletionProposal( prefix + getEndMarkups()[closingTagId], offset - prefix.length(),
+                                                    prefix.length(), prefix.length()
+                                                        + getEndMarkups()[closingTagId].length(),
+                                                    getImageMarkups()[closingTagId], getEndMarkups()[closingTagId],
+                                                    null, null ) );
+
+            }
+
+            // Autocomplete for same tags
+            for ( int i = 0; i < getStartMarkups().length; i++ )
+            {
+                if ( getStartMarkups()[i].startsWith( startTag ) && !getStartMarkups()[i].equals( startTag ) )
+                {
+                    result.add( new CompletionProposal( getStartMarkups()[i], offset - prefix.length(),
+                                                        prefix.length(), getStartMarkups()[i].length(),
+                                                        getImageMarkups()[i], getStartMarkups()[i], null, null ) );
+                }
+            }
+        }
+
+        return (ICompletionProposal[]) result.toArray( new ICompletionProposal[result.size()] );
+    }
+
+    /** {@inheritDoc} */
+    public IContextInformation[] computeContextInformation( ITextViewer viewer, int offset )
+    {
+        return NO_CONTEXTS;
+    }
+
+    /** {@inheritDoc} */
+    public char[] getCompletionProposalAutoActivationCharacters()
+    {
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    public String getErrorMessage()
+    {
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    public char[] getContextInformationAutoActivationCharacters()
+    {
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    public IContextInformationValidator getContextInformationValidator()
+    {
+        return null;
+    }
+
+    public abstract String[] getStartMarkups();
+
+    public abstract String[] getEndMarkups();
+
+    public abstract Image[] getImageMarkups();
+
+    // ----------------------------------------------------------------------
+    // Protected methods
+    // ----------------------------------------------------------------------
+
+    protected String lastWord( IDocument doc, int offset )
+    {
+        try
+        {
+            int startPart = doc.getPartition( offset ).getOffset();
+            String prefix = doc.get( startPart, offset - startPart );
+
+            return stripLastWord( prefix );
+        }
+        catch ( BadLocationException e )
+        {
+            CommonPlugin.logError( "BadLocationException: " + e.getMessage(), e );
+        }
+
+        return "";
+    }
+
+    protected String getStartTag( IDocument doc, int offset, String prefix )
+    {
+        String startTag = null;
+        for ( int i = getStartMarkups().length - 1; i >= 0; i-- )
+        {
+            if ( prefix.indexOf( getEndMarkups()[i] ) != -1 )
+            {
+                prefix = StringUtils.replace( prefix, getStartMarkups()[i], "" );
+            }
+        }
+
+        for ( int i = getStartMarkups().length - 1; i >= 0; i-- )
+        {
+            if ( prefix.indexOf( getStartMarkups()[i] ) != -1 )
+            {
+                return getStartMarkups()[i];
+            }
+        }
+
+        return startTag;
+    }
+
+    // ----------------------------------------------------------------------
+    // Private methods
+    // ----------------------------------------------------------------------
+
+    private static String stripLastWord( String prefix )
+    {
+        if ( StringUtils.isEmpty( prefix ) )
+        {
+            return prefix;
+        }
+
+        if ( Character.isWhitespace( prefix.charAt( prefix.length() - 1 ) ) )
+        {
+            return "";
+        }
+        else
+        {
+            char[] c = prefix.toCharArray();
+            int start = 0;
+            for ( int i = c.length - 1; i >= 0; i-- )
+            {
+                if ( Character.isWhitespace( c[i] ) )
+                {
+                    start = i + 1;
+                    break;
+                }
+            }
+
+            return prefix.substring( start, prefix.length() );
+        }
+    }
+}

Propchange: maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/contentassist/AbstractContentAssistProcessor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/contentassist/AbstractContentAssistProcessor.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/dialogs/AbstractDialog.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/dialogs/AbstractDialog.java?rev=645502&view=auto
==============================================================================
--- maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/dialogs/AbstractDialog.java (added)
+++ maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/dialogs/AbstractDialog.java Mon Apr  7 06:18:18 2008
@@ -0,0 +1,99 @@
+package org.apache.maven.doxia.ide.eclipse.common.ui.dialogs;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.doxia.ide.eclipse.common.ui.CommonPlugin;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+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.Shell;
+
+/**
+ * Abstract class to provide dialog with the user.
+ *
+ * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
+ * @version $Id$
+ * @since 1.0
+ */
+public abstract class AbstractDialog
+    extends Dialog
+{
+    /** OK button */
+    protected Button okButton;
+
+    /** Canvel button */
+    protected Button cancelButton;
+
+    /**
+     * Default constructor
+     *
+     * @param parent
+     */
+    public AbstractDialog( Shell parent )
+    {
+        super( parent );
+    }
+
+    // ----------------------------------------------------------------------
+    // Public methods
+    // ----------------------------------------------------------------------
+
+    @Override
+    public Shell getShell()
+    {
+        Shell shell = super.getShell();
+        shell.setImage( CommonPlugin.getImage( CommonPlugin.IMG_DOXIA ) );
+
+        return shell;
+    }
+
+    // ----------------------------------------------------------------------
+    // Protected methods
+    // ----------------------------------------------------------------------
+
+    @Override
+    protected Control createDialogArea( Composite parent )
+    {
+        Composite composite = (Composite) super.createDialogArea( parent );
+        GridLayout layout = (GridLayout) composite.getLayout();
+        layout.marginWidth = 10;
+        layout.marginHeight = 10;
+        layout.numColumns = 2;
+
+        GridData gridData = (GridData) composite.getLayoutData();
+        gridData.verticalIndent = 5;
+
+        return composite;
+    }
+
+    @Override
+    protected void createButtonsForButtonBar( Composite parent )
+    {
+        createButton( parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true );
+        createButton( parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false );
+
+        okButton = super.getButton( IDialogConstants.OK_ID );
+        cancelButton = super.getButton( IDialogConstants.CANCEL_ID );
+    }
+}

Propchange: maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/dialogs/AbstractDialog.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/dialogs/AbstractDialog.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/dialogs/AddLinkDialog.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/dialogs/AddLinkDialog.java?rev=645502&view=auto
==============================================================================
--- maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/dialogs/AddLinkDialog.java (added)
+++ maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/dialogs/AddLinkDialog.java Mon Apr  7 06:18:18 2008
@@ -0,0 +1,187 @@
+package org.apache.maven.doxia.ide.eclipse.common.ui.dialogs;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.doxia.ide.eclipse.common.ui.CommonPluginMessages;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * Dialog to add a link in a Doxia document.
+ *
+ * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
+ * @version $Id$
+ * @since 1.0
+ */
+public class AddLinkDialog
+    extends AbstractDialog
+{
+    protected Link link = new Link();
+
+    protected Text urlText;
+
+    protected Text urlDisplayNameText;
+
+    protected ModifyListener urlTextModifyListener = new ModifyListener()
+    {
+        /** {@inheritDoc} */
+        public void modifyText( ModifyEvent e )
+        {
+            if ( okButton != null )
+            {
+                okButton.setEnabled( urlText.getText().trim().length() > 0 );
+            }
+        }
+    };
+
+    /**
+     * Default constructor
+     *
+     * @param parent
+     */
+    public AddLinkDialog( Shell parent )
+    {
+        super( parent );
+    }
+
+    // ----------------------------------------------------------------------
+    // Public methods
+    // ----------------------------------------------------------------------
+
+    /**
+     * @return an <code>Link</code> object
+     */
+    public Link getLink()
+    {
+        return link;
+    }
+
+    // ----------------------------------------------------------------------
+    // Protected methods
+    // ----------------------------------------------------------------------
+
+    @Override
+    protected Control createDialogArea( Composite parent )
+    {
+        Composite composite = (Composite) super.createDialogArea( parent );
+
+        Label urlLabel = new Label( composite, SWT.NONE );
+        urlLabel.setText( getString( "url.label" ) );
+        urlText = new Text( composite, SWT.BORDER );
+        GridData gridDataUrl = new GridData( GridData.FILL_HORIZONTAL );
+        gridDataUrl.widthHint = 500;
+        urlText.setLayoutData( gridDataUrl );
+        urlText.addModifyListener( urlTextModifyListener );
+
+        Label urlDisplayNameLabel = new Label( composite, SWT.NONE );
+        urlDisplayNameLabel.setText( getString( "name.label" ) );
+        urlDisplayNameText = new Text( composite, SWT.BORDER );
+        GridData gridDataName = new GridData( GridData.FILL_HORIZONTAL );
+        gridDataName.widthHint = 500;
+        urlDisplayNameText.setLayoutData( gridDataName );
+
+        super.getShell().setText( getString( "title.label" ) );
+
+        return composite;
+    }
+
+    @Override
+    protected void createButtonsForButtonBar( Composite parent )
+    {
+        super.createButtonsForButtonBar( parent );
+
+        okButton.setEnabled( false );
+    }
+
+    @Override
+    protected void okPressed()
+    {
+        String url = urlText.getText();
+        if ( url != null && url.length() > 0 )
+        {
+            link.setURL( url );
+            link.setName( urlDisplayNameText.getText() );
+        }
+
+        super.okPressed();
+    }
+
+    /**
+     * Link bean.
+     */
+    public class Link
+    {
+        private String name;
+
+        private String url;
+
+        public Link()
+        {
+        }
+
+        /**
+         * @return the link name.
+         */
+        public String getName()
+        {
+            return name;
+        }
+
+        /**
+         * @param name the link name
+         */
+        public void setName( String name )
+        {
+            this.name = name;
+        }
+
+        /**
+         * @return the link URL
+         */
+        public String getURL()
+        {
+            return url;
+        }
+
+        /**
+         * @param url the link URL
+         */
+        public void setURL( String url )
+        {
+            this.url = url;
+        }
+    }
+
+    // ----------------------------------------------------------------------
+    // Private methods
+    // ----------------------------------------------------------------------
+
+    private static String getString( String subkey )
+    {
+        return CommonPluginMessages.getString( "AddLinkDialog." + subkey );
+    }
+}

Propchange: maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/dialogs/AddLinkDialog.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/doxia/doxia-tools/trunk/doxia-ide/eclipse/plugins/org.apache.maven.doxia.ide.eclipse.common.ui/src/main/java/org/apache/maven/doxia/ide/eclipse/common/ui/dialogs/AddLinkDialog.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision