diff options
author | Mikhail Voitenko <mav@openoffice.org> | 2007-12-13 09:34:07 +0000 |
---|---|---|
committer | Mikhail Voitenko <mav@openoffice.org> | 2007-12-13 09:34:07 +0000 |
commit | 7f1c15e5149bbe53918d99f47cbbe15643ded35c (patch) | |
tree | bb7c7b1420c374a558c9c5a3d5e89ba2e52b6935 | |
parent | 2659ded9f4e3590ce673501ff0dd3bb52c319ee5 (diff) |
adjust UI
5 files changed, 64 insertions, 19 deletions
diff --git a/swext/mediawiki/src/com/sun/star/wiki/Helper.java b/swext/mediawiki/src/com/sun/star/wiki/Helper.java index 1a907dd8a572..f3101987a86d 100644 --- a/swext/mediawiki/src/com/sun/star/wiki/Helper.java +++ b/swext/mediawiki/src/com/sun/star/wiki/Helper.java @@ -4,9 +4,9 @@ * * $RCSfile: Helper.java,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: mav $ $Date: 2007-11-28 11:13:38 $ + * last change: $Author: mav $ $Date: 2007-12-13 10:34:07 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -607,5 +607,44 @@ public class Helper return aHostConfig; } + private static XControl GetControlFromDialog( XDialog xDialog, String aControlName ) + { + XControl xResult = null; + XControlContainer xControlCont = (XControlContainer) UnoRuntime.queryInterface( XControlContainer.class, xDialog ); + + if ( xControlCont != null ) + { + Object oControl = xControlCont.getControl( aControlName ); + xResult = ( XControl ) UnoRuntime.queryInterface( XControl.class, oControl ); + } + + return xResult; + } + + private static XPropertySet GetSubControlPropSet( XDialog xDialog, String aControlName ) + { + XControl xControl = GetControlFromDialog( xDialog, aControlName ); + if ( xControl != null ) + return ( XPropertySet ) UnoRuntime.queryInterface( XPropertySet.class, xControl.getModel() ); + + return null; + } + + private static void SetControlPropInDialog( XDialog xDialog, String aControlName, String aPropName, Object aPropValue ) + { + if ( xDialog != null && aControlName != null && aPropName != null && aPropValue != null ) + { + try + { + XPropertySet xPropSet = GetSubControlPropSet( xDialog, aControlName ); + if ( xPropSet != null ) + xPropSet.setPropertyValue( aPropName, aPropValue ); + } + catch ( com.sun.star.uno.Exception e ) + { + e.printStackTrace(); + } + } + } } diff --git a/swext/mediawiki/src/com/sun/star/wiki/WikiDialog.java b/swext/mediawiki/src/com/sun/star/wiki/WikiDialog.java index 365f9806c9e9..d003c4c3013e 100644 --- a/swext/mediawiki/src/com/sun/star/wiki/WikiDialog.java +++ b/swext/mediawiki/src/com/sun/star/wiki/WikiDialog.java @@ -4,9 +4,9 @@ * * $RCSfile: WikiDialog.java,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: mav $ $Date: 2007-11-28 11:14:46 $ + * last change: $Author: mav $ $Date: 2007-12-13 10:34:07 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -97,6 +97,9 @@ public class WikiDialog implements XDialogEventHandler{ protected XPropertySet getPropSet(String sControl) { XControl xControl = m_xControlContainer.getControl(sControl); XPropertySet xPS = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, xControl.getModel() ); + if ( xPS == null ) + throw new com.sun.star.uno.RuntimeException(); + return xPS; } diff --git a/swext/mediawiki/src/com/sun/star/wiki/WikiEditSettingDialog.java b/swext/mediawiki/src/com/sun/star/wiki/WikiEditSettingDialog.java index 99c583756290..025a0569e21e 100644 --- a/swext/mediawiki/src/com/sun/star/wiki/WikiEditSettingDialog.java +++ b/swext/mediawiki/src/com/sun/star/wiki/WikiEditSettingDialog.java @@ -4,9 +4,9 @@ * * $RCSfile: WikiEditSettingDialog.java,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: mav $ $Date: 2007-11-28 11:15:09 $ + * last change: $Author: mav $ $Date: 2007-12-13 10:34:07 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -135,7 +135,7 @@ public class WikiEditSettingDialog extends WikiDialog if ( sRedirectURL.equals( "" ) ) { // show error - ErrorDialog ed = new ErrorDialog( m_xContext, "vnd.sun.star.script:WikiEditor.Error?location=application", "This is not a Wiki Page!" ); + ErrorDialog ed = new ErrorDialog( m_xContext, "vnd.sun.star.script:WikiEditor.Error?location=application", "A connection to the MediaWiki system at '" + sRedirectURL + "' could not be created." ); ed.show(); } } @@ -146,7 +146,7 @@ public class WikiEditSettingDialog extends WikiDialog { // a wrong login information is provided // show error - ErrorDialog ed = new ErrorDialog( m_xContext, "vnd.sun.star.script:WikiEditor.Error?location=application", "The login information is wrong! It should either be empty or correct." ); + ErrorDialog ed = new ErrorDialog( m_xContext, "vnd.sun.star.script:WikiEditor.Error?location=application", "User name or password is incorrect. Please try again, or leave the fields blank for an anonymous connection." ); ed.show(); } else @@ -166,7 +166,7 @@ public class WikiEditSettingDialog extends WikiDialog { // URL invalid // show error - ErrorDialog ed = new ErrorDialog( m_xContext, "vnd.sun.star.script:WikiEditor.Error?location=application", "The URl is invalid!" ); + ErrorDialog ed = new ErrorDialog( m_xContext, "vnd.sun.star.script:WikiEditor.Error?location=application", "A connection could not be created, because the URL is invalid." ); ed.show(); } } @@ -174,7 +174,7 @@ public class WikiEditSettingDialog extends WikiDialog { // URL field empty // show error - ErrorDialog ed = new ErrorDialog( m_xContext, "vnd.sun.star.script:WikiEditor.Error?location=application", "The URL field is empty!" ); + ErrorDialog ed = new ErrorDialog( m_xContext, "vnd.sun.star.script:WikiEditor.Error?location=application", "Specify a MediaWiki server by providing a URL." ); ed.show(); } @@ -182,7 +182,7 @@ public class WikiEditSettingDialog extends WikiDialog } catch ( Exception ex ) { - ErrorDialog ed = new ErrorDialog( m_xContext, "vnd.sun.star.script:WikiEditor.Error?location=application", "Can not access the provided URL for any reason!" ); + ErrorDialog ed = new ErrorDialog( m_xContext, "vnd.sun.star.script:WikiEditor.Error?location=application", "A connection to the MediaWiki system at '" + sRedirectURL + "' could not be created." ); ed.show(); ex.printStackTrace(); diff --git a/swext/mediawiki/src/com/sun/star/wiki/WikiEditorImpl.java b/swext/mediawiki/src/com/sun/star/wiki/WikiEditorImpl.java index a11c01d785d9..66c11a64e46d 100644 --- a/swext/mediawiki/src/com/sun/star/wiki/WikiEditorImpl.java +++ b/swext/mediawiki/src/com/sun/star/wiki/WikiEditorImpl.java @@ -4,9 +4,9 @@ * * $RCSfile: WikiEditorImpl.java,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: mav $ $Date: 2007-11-28 11:14:58 $ + * last change: $Author: mav $ $Date: 2007-12-13 10:34:07 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -75,6 +75,7 @@ public final class WikiEditorImpl extends WeakBase private final XComponentContext m_xContext; private static final String m_implementationName = WikiEditorImpl.class.getName(); private static final String[] m_serviceNames = {"com.sun.star.wiki.WikiEditor" }; + private static final String m_sGeneralSendError = "The operation 'Send to MediaWiki' could not be completed successfully."; // information needed for component registration public static final String[] supportedServiceNames = {"com.sun.star.frame.ProtocolHandler"}; @@ -399,7 +400,7 @@ public final class WikiEditorImpl extends WeakBase if ( m_aFilterName == null || m_aFilterName.length() == 0 ) { - ErrorDialog ed = new ErrorDialog(m_xContext, "vnd.sun.star.script:WikiEditor.Error?location=application", "MediaWiki filter is requered to be able to export!"); + ErrorDialog ed = new ErrorDialog(m_xContext, "vnd.sun.star.script:WikiEditor.Error?location=application", "The MediaWiki export filter cannot be found. Choose 'Tools-XML Filter Settings' to install the filter, or use the setup to install the component."); ed.show(); throw new com.sun.star.uno.RuntimeException(); } @@ -441,6 +442,8 @@ public final class WikiEditorImpl extends WeakBase XDialog xDialog = WikiDialog.CreateSimpleDialog( m_xContext, "vnd.sun.star.script:WikiEditor.NewWikiPage?location=application" ); if ( xDialog != null ) { + Helper.SetControlPropInDialog( xDialog, "Label1", "Label", "A wiki article with the title " + aSendDialog.m_sWikiTitle + " does not exist yet. Do you want to create a new article with that name?" ); + aSendDialog.SetThrobberActive( false ); bAllowSending = MainThreadDialogExecutor.Execute( m_xContext, xDialog ); aSendDialog.SetThrobberActive( true ); @@ -486,7 +489,7 @@ public final class WikiEditorImpl extends WeakBase } else { - ErrorDialog ed = new ErrorDialog(m_xContext, "vnd.sun.star.script:WikiEditor.Error?location=application", "Sending of the document has failed!"); + ErrorDialog ed = new ErrorDialog(m_xContext, "vnd.sun.star.script:WikiEditor.Error?location=application", m_sGeneralSendError ); MainThreadDialogExecutor.Show( m_xContext, ed ); } } @@ -500,7 +503,7 @@ public final class WikiEditorImpl extends WeakBase if ( Helper.IsConnectionAllowed() ) { // report the error only if sending was not cancelled - ErrorDialog ed = new ErrorDialog(m_xContext, "vnd.sun.star.script:WikiEditor.Error?location=application", "Sending of the document has failed!"); + ErrorDialog ed = new ErrorDialog(m_xContext, "vnd.sun.star.script:WikiEditor.Error?location=application", m_sGeneralSendError ); MainThreadDialogExecutor.Show( m_xContext, ed ); } e.printStackTrace(); diff --git a/swext/mediawiki/src/com/sun/star/wiki/WikiPropDialog.java b/swext/mediawiki/src/com/sun/star/wiki/WikiPropDialog.java index 2bed67061f96..92ffae5124d0 100644 --- a/swext/mediawiki/src/com/sun/star/wiki/WikiPropDialog.java +++ b/swext/mediawiki/src/com/sun/star/wiki/WikiPropDialog.java @@ -4,9 +4,9 @@ * * $RCSfile: WikiPropDialog.java,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: mav $ $Date: 2007-11-28 11:15:31 $ + * last change: $Author: mav $ $Date: 2007-12-13 10:34:07 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -305,7 +305,7 @@ public class WikiPropDialog extends WikiDialog{ } else { - ErrorDialog aED = new ErrorDialog( m_xContext, "vnd.sun.star.script:WikiEditor.Error?location=application", "The sending process has been stopped. But the wiki-page might be already changed!" ); + ErrorDialog aED = new ErrorDialog( m_xContext, "vnd.sun.star.script:WikiEditor.Error?location=application", "The transfer has been interrupted. Please check the integrity of the wiki article." ); aED.show(); } |