log4j.configuration=file:../../log4j-demo.properties
-## important to enable internationalization of plugin.xml labels.
+## important to enable internationalization of plugin.xml labels.
+## Note that enabling this reduce server performances; see
+## bug 244468 for details : https://bugs.eclipse.org/bugs/show_bug.cgi?id=244468
eclipse.registry.MultiLanguage=true
# Note default URL to access the webapp
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
-
<!-- Views -->
<bean id="simpleTreeView" class="org.argeo.demo.i18n.views.SimpleTreeView"
scope="prototype">
class="org.argeo.demo.i18n.I18nDemoPerspective"
icon="icons/i18n.gif"
id="org.argeo.demo.i18n.perspective"
- name="%I18nDemoPerspective_name">
+ name="%I18nDemoPerspective_Name">
</perspective>
</extension>
<!-- Views -->
class="org.argeo.eclipse.spring.SpringExtensionFactory"
icon="icons/browser.gif"
id="org.argeo.demo.i18n.simpleTreeView"
- name="%SimpleTreeView_name">
+ name="%SimpleTreeView_Name">
</view>
</extension>
<!-- Editors -->
<editor
class="org.argeo.eclipse.spring.SpringExtensionFactory"
id="org.argeo.demo.i18n.simpleMultitabEditor"
- name="%SimpleMultitabEditor_name"
+ name="%SimpleMultitabEditor_Name"
icon="icons/i18n.gif"
default="false">
</editor>
<!-- Commands -->
<extension
point="org.eclipse.ui.commands">
- <command
- defaultHandler="org.argeo.eclipse.spring.SpringCommandHandler"
- id="org.argeo.jcr.ui.explorer.openGenericNodeEditor"
- name="Open generic node Editor">
- <commandParameter
- id="org.argeo.jcr.ui.explorer.nodePath"
- name="Node path">
- </commandParameter>
- </command>
+ <command
+ defaultHandler="org.argeo.demo.i18n.commands.OpenDialog"
+ id="org.argeo.demo.i18n.openDialog"
+ name="This name should not be displayed - check plugin.xml">
+ </command>
</extension>
<!-- Menus -->
<extension point="org.eclipse.ui.menus">
<menuContribution
locationURI="popup:org.argeo.demo.i18n.simpleTreeView">
+ <command
+ commandId="org.argeo.demo.i18n.openDialog"
+ style="push"
+ label="%OpenDialog_Label">
+ </command>
</menuContribution>
</extension>
## commands label
+OpenDialog_Label=Open a dialog box
## View, perspective and editor labels
-I18nDemoPerspective_name=Demo Internationalization
-SimpleTreeView_name=Simple tree view
-SimpleMultitabEditor_name=Simple multi-tab editor
+I18nDemoPerspective_Name=Demo Internationalization
+SimpleTreeView_Name=Simple tree view
+SimpleMultitabEditor_Name=Simple multi-tab editor
LocaleSettingsPage_Title=Manage localization settings
\ No newline at end of file
## commands label
+OpenDialog_Label=Ouvrir une fenêtre de dialogue
## View, perspective and editor labels
-I18nDemoPerspective_name=Demo - Internationalisation
-SimpleTreeView_name=Simple vue en arbre
-SimpleMultitabEditor_name=Simple editeur à onglets multiples.
+I18nDemoPerspective_Name=Demo - Internationalisation
+SimpleTreeView_Name=Simple vue en arbre
+SimpleMultitabEditor_Name=Simple editeur à onglets multiples.
LocaleSettingsPage_Title=Gérer les informations de localisation
\ No newline at end of file
private static final String BUNDLENAME = I18nDemoPlugin.ID + ".messages"; // $NON-NLS−1$
+ // Errors & warnings
+ public String OpenDialog_Title;
+ public String OpenDialog_Message;
+
+ // Commands
+
+ // Editor
public String SimpleMultitabEditor_MultiSectionPageTitle;
public String SimpleMultitabEditor_SimplePageTitle;
- public String MultiSelectionPage_DescriptionSectionTitle;
- public String MultiSelectionPage_DetailsSectionTitle;
- public String testLbl;
+
+ // Pages
+ public String MultiSectionPage_DescriptionSectionTitle;
+ public String MultiSectionPage_DescriptionSectionTxt;
+ public String MultiSectionPage_DetailsSectionTitle;
+ public String MultiSectionPage_PopupTitle;
+ public String MultiSectionPage_PopupText;
+ public String SimplePage_DescriptionTxt;
+
+ // Buttons
+ public String MultiSectionPage_Btn1Lbl;
+ public String MultiSectionPage_Btn2Lbl;
+ public String MultiSectionPage_Btn3Lbl;
// Code that enable handling of concurrent multi sessions locales
static {
* The constructor
*/
public I18nDemoPlugin() {
- // Locale currentLocale = new Locale("fr");
- // Locale.setDefault(currentLocale);
}
/*
import java.text.MessageFormat;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
/**
* This class enable single sourcing between RAP and RCP. For this to run
* correctly, following conventions must be respected:
*/
public class ImplementationLoader {
- private final static Log log = LogFactory
- .getLog(ImplementationLoader.class);
+ // private final static Log log = LogFactory
+ // .getLog(ImplementationLoader.class);
public static Object newInstance(
@SuppressWarnings("rawtypes") final Class type) {
--- /dev/null
+package org.argeo.demo.i18n.commands;
+
+import org.argeo.demo.i18n.I18nDemoMessages;
+import org.argeo.demo.i18n.I18nDemoPlugin;
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.MessageBox;
+
+/**
+ * Open a dummy dialog box with internationalized messages.
+ */
+public class OpenDialog extends AbstractHandler {
+
+ public final static String ID = I18nDemoPlugin.ID + ".openDialog";
+
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+
+ MessageBox mb = new MessageBox(I18nDemoPlugin.getDefault()
+ .getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.OK
+ | SWT.CANCEL);
+
+ // Title
+ mb.setText(I18nDemoMessages.get().OpenDialog_Title);
+
+ // Message
+ mb.setMessage(I18nDemoMessages.get().OpenDialog_Message);
+ mb.open();
+
+ return null;
+ }
+}
package org.argeo.demo.i18n.editors;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.argeo.demo.i18n.I18nDemoMessages;
+import org.argeo.demo.i18n.I18nDemoPlugin;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.forms.AbstractFormPart;
import org.eclipse.ui.forms.IManagedForm;
import org.eclipse.ui.forms.widgets.ScrolledForm;
import org.eclipse.ui.forms.widgets.Section;
import org.eclipse.ui.forms.widgets.TableWrapData;
-import org.eclipse.ui.forms.widgets.TableWrapLayout;
/**
* Offers two main sections : one to display a text area with a summary of all
* enable browsing
* */
public class MultiSectionPage extends FormPage {
- private final static Log log = LogFactory.getLog(MultiSectionPage.class);
+ // private final static Log log = LogFactory.getLog(MultiSectionPage.class);
// this page UI components
private FormToolkit tk;
Composite body = form.getBody();
body.setLayout(twt);
- createHistorySection(form.getBody());
- createTreeSection(form.getBody());
+ createDetailsSection(form.getBody());
+ createDescriptionSection(form.getBody());
}
- protected void createTreeSection(Composite parent) {
+ protected void createDescriptionSection(Composite parent) {
// Section Layout & MetaData
Section section = tk.createSection(parent, Section.TWISTIE);
section.setLayoutData(new GridData(GridData.FILL_BOTH));
- section.setText(I18nDemoMessages.get().MultiSelectionPage_DescriptionSectionTitle);
+ section.setText(I18nDemoMessages.get().MultiSectionPage_DescriptionSectionTitle);
// Section Body
Composite body = tk.createComposite(section, SWT.FILL);
body.setLayoutData(new GridData(GridData.FILL_BOTH));
section.setExpanded(true);
+
+ // button line
+ Button b1 = new Button(body, SWT.PUSH | SWT.FILL);
+ b1.setText(I18nDemoMessages.get().MultiSectionPage_Btn1Lbl);
+ Button b2 = new Button(body, SWT.PUSH | SWT.FILL);
+ b2.setText(I18nDemoMessages.get().MultiSectionPage_Btn2Lbl);
+ Button b3 = new Button(body, SWT.PUSH | SWT.FILL);
+ b3.setText(I18nDemoMessages.get().MultiSectionPage_Btn3Lbl);
+
+ addAListener(b1);
+ addAListener(b2);
+ addAListener(b3);
+ }
+
+ private void addAListener(Button b) {
+ b.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ MessageBox mb = new MessageBox(I18nDemoPlugin.getDefault()
+ .getWorkbench().getActiveWorkbenchWindow().getShell(),
+ SWT.OK);
+ // Title
+ mb.setText(I18nDemoMessages.get().MultiSectionPage_PopupTitle);
+ // Message
+ mb.setMessage(I18nDemoMessages.get().MultiSectionPage_PopupText);
+ mb.open();
+ }
+ });
}
- protected void createHistorySection(Composite parent) {
+ protected void createDetailsSection(Composite parent) {
// Section Layout
Section section = tk.createSection(parent, Section.TWISTIE);
section.setLayoutData(new GridData(TableWrapData.FILL_GRAB));
- TableWrapLayout twt = new TableWrapLayout();
- section.setLayout(twt);
+ GridLayout gd = new GridLayout();
+ section.setLayout(gd);
// Set title of the section
- section.setText(I18nDemoMessages.get().MultiSelectionPage_DetailsSectionTitle);
+ section.setText(I18nDemoMessages.get().MultiSectionPage_DetailsSectionTitle);
final Text styledText = tk.createText(section, "", SWT.FULL_SELECTION
- | SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
+ | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
styledText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- section.setClient(styledText);
styledText.setEditable(false);
+ styledText
+ .setText(I18nDemoMessages.get().MultiSectionPage_DescriptionSectionTxt);
section.setExpanded(false);
+ section.setClient(styledText);
+
AbstractFormPart part = new AbstractFormPart() {
public void commit(boolean onSave) {
}
package org.argeo.demo.i18n.editors;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.argeo.ArgeoException;
import org.argeo.demo.i18n.I18nDemoMessages;
import org.argeo.demo.i18n.I18nDemoPlugin;
*/
public class SimpleMultitabEditor extends FormEditor {
- private final static Log log = LogFactory
- .getLog(SimpleMultitabEditor.class);
+ // private final static Log log = LogFactory
+ // .getLog(SimpleMultitabEditor.class);
public final static String ID = I18nDemoPlugin.ID + ".simpleMultitabEditor";
private SimplePage simplePage;
package org.argeo.demo.i18n.editors;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
+import org.argeo.demo.i18n.I18nDemoMessages;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.forms.AbstractFormPart;
import org.eclipse.ui.forms.IManagedForm;
import org.eclipse.ui.forms.editor.FormEditor;
*/
public class SimplePage extends FormPage {
- private final static Log log = LogFactory.getLog(SimplePage.class);
+ // private final static Log log = LogFactory.getLog(SimplePage.class);
// Utils
// protected DateFormat timeFormatter = new
// This page widgets
private FormToolkit tk;
- private List<Control> modifyableProperties = new ArrayList<Control>();
+
+ // private List<Control> modifyableProperties = new ArrayList<Control>();
public SimplePage(FormEditor editor, String title) {
super(editor, "id", title);
private void createPropertiesPart(Composite parent) {
// Initializes form part
- tk.createLabel(parent, "Implement something");
+ tk.createLabel(parent, I18nDemoMessages.get().SimplePage_DescriptionTxt);
AbstractFormPart part = new AbstractFormPart() {
public void commit(boolean onSave) {
if (onSave) {
//
// LISTENERS
//
-
- private class ModifiedFieldListener implements ModifyListener {
-
- private AbstractFormPart formPart;
-
- public ModifiedFieldListener(AbstractFormPart generalPart) {
- this.formPart = generalPart;
- }
-
- public void modifyText(ModifyEvent e) {
- formPart.markDirty();
- }
- }
-
+ /*
+ * UNUSED FOR THE TIME BEING private class ModifiedFieldListener implements
+ * ModifyListener {
+ *
+ * private AbstractFormPart formPart;
+ *
+ * public ModifiedFieldListener(AbstractFormPart generalPart) {
+ * this.formPart = generalPart; }
+ *
+ * public void modifyText(ModifyEvent e) { formPart.markDirty(); } }
+ */
}
"An example of a multiple-choice preference", 1,
new String[][] { { "&Choice 1", "choice1" },
{ "C&hoice 2", "choice2" } }, getFieldEditorParent()));
- addField(new StringFieldEditor("MySTRING1", "A &text preference:",
+ addField(new StringFieldEditor("locale", "Chosen locale",
getFieldEditorParent()));
addField(new StringFieldEditor("MySTRING2", "A &text preference:",
getFieldEditorParent()));
package org.argeo.demo.i18n.utils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.argeo.ArgeoException;
import org.argeo.demo.i18n.I18nDemoPlugin;
import org.argeo.demo.i18n.editors.SimpleMultitabEditor;
*/
public class GenericDoubleClickListener implements IDoubleClickListener {
- private final static Log log = LogFactory
- .getLog(GenericDoubleClickListener.class);
+ // private final static Log log = LogFactory
+ // .getLog(GenericDoubleClickListener.class);
- private TreeViewer treeViewer;
+ // private TreeViewer treeViewer;
public GenericDoubleClickListener(TreeViewer treeViewer) {
- this.treeViewer = treeViewer;
+ // this.treeViewer = treeViewer;
}
public void doubleClick(DoubleClickEvent event) {
package org.argeo.demo.i18n.views;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.argeo.demo.i18n.I18nDemoPlugin;
import org.argeo.demo.i18n.providers.SimpleContentProvider;
import org.argeo.demo.i18n.providers.SimpleLabelProvider;
*/
public class SimpleTreeView extends ViewPart {
- private final static Log log = LogFactory.getLog(SimpleTreeView.class);
-
+ // private final static Log log = LogFactory.getLog(SimpleTreeView.class);
public final static String ID = I18nDemoPlugin.ID + ".simpleTreeView";
// This page widgets
@Override
public void setFocus() {
// Do nothing for the time being.
-
}
-
}
## Generic labels
## Errors & warnings
+OpenDialog_Title=Dialog Popup
+OpenDialog_Message=This pop-up shows an internationalized message to the end user.
## Commands
SimpleMultitabEditor_SimplePageTitle=Base information
## Pages
-MultiSelectionPage_DescriptionSectionTitle=Description
-MultiSelectionPage_DetailsSectionTitle=Details
+MultiSectionPage_DescriptionSectionTitle=Description
+MultiSectionPage_DescriptionSectionTxt=This section displays an internationalized text description.
+MultiSectionPage_DetailsSectionTitle=Details
+MultiSectionPage_PopupTitle=Popup Title
+MultiSectionPage_PopupText=Current window has been open thanks to a button.
-
+SimplePage_DescriptionTxt=This editor does nothing. It's just here to present all widgets' Ui that can be internationalized with i18n mecanisms.
+
+## Buttons
+MultiSectionPage_Btn1Lbl=First button
+MultiSectionPage_Btn2Lbl=Second button
+MultiSectionPage_Btn3Lbl=Third button
+
## Dummy ones
testLbl=Internationalizations of messages seems to work properly.
## Generic labels
-
## Errors & warnings
+OpenDialog_Title=Pop-up de dialogue
+OpenDialog_Message=Cette fenêtre montre un message internationalisé.
## Commands
SimpleMultitabEditor_MultiSectionPageTitle=Plus d'informations
SimpleMultitabEditor_SimplePageTitle=Informations de base
## Pages
-MultiSelectionPage_DescriptionSectionTitle=Description
-MultiSelectionPage_DetailsSectionTitle=Détails
+MultiSectionPage_DescriptionSectionTitle=Description
+MultiSectionPage_DescriptionSectionTxt=Cette section contient une description internationalisée.
+MultiSectionPage_DetailsSectionTitle=Détails
+MultiSectionPage_PopupTitle=Titre de la fenêtre
+MultiSectionPage_PopupText=Cette fenêtre a été ouverte par un bouton
+
+SimplePage_DescriptionTxt=Cet éditeur ne fait rien, il permet juste de présenter l'ensemble des éléments d'UI internationalisable via les mécanisme i18n d'Eclipse.
+
+## Buttons
+MultiSectionPage_Btn1Lbl=Premier bouton
+MultiSectionPage_Btn2Lbl=Deuxième bouton
+MultiSectionPage_Btn3Lbl=Troisième bouton
## Dummy ones
testLbl=L'internationnalisation des messages semble fonctionner correctement.