summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Lettmayer2013-01-05 09:03:17 (EST)
committer Martin Reiterer2013-01-05 09:09:05 (EST)
commit346e25af5bd5970d9ad3d3dad304e4f585a4065d (patch)
tree77f23878da2f15b452e698ac221d936f884754c3
parent16f4355c352c95df76415d3909e9e89a52cbd1b3 (diff)
downloadplugins-346e25af5bd5970d9ad3d3dad304e4f585a4065d.zip
plugins-346e25af5bd5970d9ad3d3dad304e4f585a4065d.tar.gz
plugins-346e25af5bd5970d9ad3d3dad304e4f585a4065d.tar.bz2
[397123] Isolate SWT specific classes of babel editor into a separate fragment
The babel editor is used in multiple platforms (RCP / RAP). Therefore we are using a single source base for all platforms and specifc implementations for the different platforms. This enhancement contains the SWT specific implementation, which is used by the TapiJI Tools and the TapiJI RCP Translator.
-rw-r--r--org.eclipse.babel.editor.swt.compat/.classpath7
-rw-r--r--org.eclipse.babel.editor.swt.compat/.project34
-rw-r--r--org.eclipse.babel.editor.swt.compat/META-INF/MANIFEST.MF13
-rw-r--r--org.eclipse.babel.editor.swt.compat/build.properties4
-rw-r--r--org.eclipse.babel.editor.swt.compat/pom.xml13
-rw-r--r--org.eclipse.babel.editor.swt.compat/src/org/eclipse/babel/editor/compat/SwtRapCompatibilityFormToolkit.java26
-rw-r--r--org.eclipse.babel.editor.swt.compat/src/org/eclipse/babel/editor/compat/SwtRapCompatibilitySWT.java17
-rw-r--r--org.eclipse.babel.editor.swt.compat/src/org/eclipse/babel/editor/swt/compat/Activator.java45
-rw-r--r--org.eclipse.babel.editor.swt/.classpath7
-rw-r--r--org.eclipse.babel.editor.swt/.project28
-rw-r--r--org.eclipse.babel.editor.swt/META-INF/MANIFEST.MF10
-rw-r--r--org.eclipse.babel.editor.swt/build.properties5
-rw-r--r--org.eclipse.babel.editor.swt/fragment.xml26
-rw-r--r--org.eclipse.babel.editor.swt/pom.xml13
-rw-r--r--org.eclipse.babel.editor.swt/src/org/eclipse/babel/editor/i18n/I18NEntry.java88
-rw-r--r--org.eclipse.babel.editor.swt/src/org/eclipse/babel/editor/internal/MessagesEditor.java53
-rw-r--r--org.eclipse.babel.editor.swt/src/org/eclipse/babel/editor/refactoring/RefactoringHandler.java99
-rw-r--r--org.eclipse.babel.editor.swt/src/org/eclipse/babel/editor/refactoring/RenameKeyArguments.java (renamed from org.eclipse.babel.editor/src/org/eclipse/babel/editor/refactoring/RenameKeyArguments.java)0
-rw-r--r--org.eclipse.babel.editor.swt/src/org/eclipse/babel/editor/refactoring/RenameKeyChange.java (renamed from org.eclipse.babel.editor/src/org/eclipse/babel/editor/refactoring/RenameKeyChange.java)0
-rw-r--r--org.eclipse.babel.editor.swt/src/org/eclipse/babel/editor/refactoring/RenameKeyDescriptor.java (renamed from org.eclipse.babel.editor/src/org/eclipse/babel/editor/refactoring/RenameKeyDescriptor.java)0
-rw-r--r--org.eclipse.babel.editor.swt/src/org/eclipse/babel/editor/refactoring/RenameKeyProcessor.java (renamed from org.eclipse.babel.editor/src/org/eclipse/babel/editor/refactoring/RenameKeyProcessor.java)0
-rw-r--r--org.eclipse.babel.editor.swt/src/org/eclipse/babel/editor/refactoring/RenameKeyWizard.java (renamed from org.eclipse.babel.editor/src/org/eclipse/babel/editor/refactoring/RenameKeyWizard.java)0
-rw-r--r--org.eclipse.babel.editor.swt/src/org/eclipse/babel/editor/tree/actions/RenameKeyAction.java (renamed from org.eclipse.babel.editor/src/org/eclipse/babel/editor/tree/actions/RenameKeyAction.java)24
-rw-r--r--org.eclipse.babel.editor/META-INF/MANIFEST.MF35
-rw-r--r--org.eclipse.babel.editor/build.properties3
-rw-r--r--org.eclipse.babel.editor/icons/refactoring.pngbin783 -> 885 bytes
-rw-r--r--org.eclipse.babel.editor/messages.properties1
-rw-r--r--org.eclipse.babel.editor/src/org/eclipse/babel/editor/IMessagesEditor.java8
-rw-r--r--org.eclipse.babel.editor/src/org/eclipse/babel/editor/actions/FilterKeysAction.java6
-rw-r--r--org.eclipse.babel.editor/src/org/eclipse/babel/editor/actions/KeyTreeVisibleAction.java6
-rw-r--r--org.eclipse.babel.editor/src/org/eclipse/babel/editor/actions/NewLocaleAction.java6
-rw-r--r--org.eclipse.babel.editor/src/org/eclipse/babel/editor/api/EditorUtil.java5
-rwxr-xr-x[-rw-r--r--]org.eclipse.babel.editor/src/org/eclipse/babel/editor/i18n/AbstractI18NEntry.java (renamed from org.eclipse.babel.editor/src/org/eclipse/babel/editor/i18n/I18NEntry.java)118
-rw-r--r--org.eclipse.babel.editor/src/org/eclipse/babel/editor/i18n/EntryLeftBanner.java2
-rw-r--r--org.eclipse.babel.editor/src/org/eclipse/babel/editor/i18n/EntryRightBanner.java47
-rw-r--r--org.eclipse.babel.editor/src/org/eclipse/babel/editor/i18n/I18NPage.java73
-rw-r--r--org.eclipse.babel.editor/src/org/eclipse/babel/editor/i18n/SideNavComposite.java14
-rw-r--r--org.eclipse.babel.editor/src/org/eclipse/babel/editor/i18n/SideNavTextBoxComposite.java17
-rw-r--r--org.eclipse.babel.editor/src/org/eclipse/babel/editor/i18n/actions/FoldingAction.java6
-rwxr-xr-x[-rw-r--r--]org.eclipse.babel.editor/src/org/eclipse/babel/editor/internal/AbstractMessagesEditor.java (renamed from org.eclipse.babel.editor/src/org/eclipse/babel/editor/internal/MessagesEditor.java)127
-rw-r--r--org.eclipse.babel.editor/src/org/eclipse/babel/editor/internal/MessagesEditorContributor.java4
-rw-r--r--org.eclipse.babel.editor/src/org/eclipse/babel/editor/plugin/MessagesEditorPlugin.java10
-rw-r--r--org.eclipse.babel.editor/src/org/eclipse/babel/editor/preferences/MsgEditorPreferences.java6
-rw-r--r--org.eclipse.babel.editor/src/org/eclipse/babel/editor/tree/actions/AbstractRenameKeyAction.java39
-rw-r--r--org.eclipse.babel.editor/src/org/eclipse/babel/editor/tree/actions/AbstractTreeAction.java13
-rw-r--r--org.eclipse.babel.editor/src/org/eclipse/babel/editor/tree/actions/AddKeyAction.java4
-rw-r--r--org.eclipse.babel.editor/src/org/eclipse/babel/editor/tree/actions/CollapseAllAction.java5
-rw-r--r--org.eclipse.babel.editor/src/org/eclipse/babel/editor/tree/actions/DeleteKeyAction.java4
-rw-r--r--org.eclipse.babel.editor/src/org/eclipse/babel/editor/tree/actions/ExpandAllAction.java4
-rw-r--r--org.eclipse.babel.editor/src/org/eclipse/babel/editor/tree/actions/FlatModelAction.java4
-rw-r--r--org.eclipse.babel.editor/src/org/eclipse/babel/editor/tree/actions/RefactorKeyAction.java59
-rw-r--r--org.eclipse.babel.editor/src/org/eclipse/babel/editor/tree/actions/TreeModelAction.java4
-rw-r--r--org.eclipse.babel.editor/src/org/eclipse/babel/editor/tree/internal/KeyTreeContributor.java44
-rw-r--r--org.eclipse.babel.editor/src/org/eclipse/babel/editor/tree/internal/KeyTreeLabelProvider.java6
-rw-r--r--org.eclipse.babel.editor/src/org/eclipse/babel/editor/util/UIUtils.java47
-rw-r--r--org.eclipse.babel.editor/src/org/eclipse/babel/editor/views/MessagesBundleGroupOutline.java6
-rw-r--r--org.eclipse.babel.editor/src/org/eclipse/pde/nls/internal/ui/editor/LocalizationEditor.java3
57 files changed, 1007 insertions, 241 deletions
diff --git a/org.eclipse.babel.editor.swt.compat/.classpath b/org.eclipse.babel.editor.swt.compat/.classpath
new file mode 100644
index 0000000..ad32c83
--- /dev/null
+++ b/org.eclipse.babel.editor.swt.compat/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.eclipse.babel.editor.swt.compat/.project b/org.eclipse.babel.editor.swt.compat/.project
new file mode 100644
index 0000000..5c03016
--- /dev/null
+++ b/org.eclipse.babel.editor.swt.compat/.project
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.babel.editor.swt.compat</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.babel.editor.swt.compat/META-INF/MANIFEST.MF b/org.eclipse.babel.editor.swt.compat/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..7700da3
--- /dev/null
+++ b/org.eclipse.babel.editor.swt.compat/META-INF/MANIFEST.MF
@@ -0,0 +1,13 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: RCP Compatibility for Babel Editor
+Bundle-SymbolicName: org.eclipse.babel.editor.swt.compat
+Bundle-Version: 0.8.0.qualifier
+Bundle-Activator: org.eclipse.babel.editor.swt.compat.Activator
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Import-Package: org.eclipse.swt,
+ org.eclipse.swt.widgets,
+ org.eclipse.ui.forms,
+ org.eclipse.ui.forms.widgets,
+ org.osgi.framework;version="1.3.0"
+Export-Package: org.eclipse.babel.editor.compat
diff --git a/org.eclipse.babel.editor.swt.compat/build.properties b/org.eclipse.babel.editor.swt.compat/build.properties
new file mode 100644
index 0000000..34d2e4d
--- /dev/null
+++ b/org.eclipse.babel.editor.swt.compat/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/org.eclipse.babel.editor.swt.compat/pom.xml b/org.eclipse.babel.editor.swt.compat/pom.xml
new file mode 100644
index 0000000..ebb1681
--- /dev/null
+++ b/org.eclipse.babel.editor.swt.compat/pom.xml
@@ -0,0 +1,13 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.eclipse.babel.editor</groupId>
+ <artifactId>org.eclipse.babel.editor.swt.compat</artifactId>
+ <version>0.8.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+ <parent>
+ <groupId>org.eclipse.babel.tapiji.tools</groupId>
+ <artifactId>org.eclipse.babel.tapiji.tools.parent</artifactId>
+ <version>0.0.2-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+</project> \ No newline at end of file
diff --git a/org.eclipse.babel.editor.swt.compat/src/org/eclipse/babel/editor/compat/SwtRapCompatibilityFormToolkit.java b/org.eclipse.babel.editor.swt.compat/src/org/eclipse/babel/editor/compat/SwtRapCompatibilityFormToolkit.java
new file mode 100644
index 0000000..e7365ee
--- /dev/null
+++ b/org.eclipse.babel.editor.swt.compat/src/org/eclipse/babel/editor/compat/SwtRapCompatibilityFormToolkit.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Matthias Lettmayer.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Matthias Lettmayer - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.babel.editor.compat;
+
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.forms.FormColors;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+public class SwtRapCompatibilityFormToolkit extends FormToolkit {
+
+ public SwtRapCompatibilityFormToolkit(FormColors colors) {
+ super(colors);
+ }
+
+ public SwtRapCompatibilityFormToolkit(Display display) {
+ super(display);
+ }
+}
diff --git a/org.eclipse.babel.editor.swt.compat/src/org/eclipse/babel/editor/compat/SwtRapCompatibilitySWT.java b/org.eclipse.babel.editor.swt.compat/src/org/eclipse/babel/editor/compat/SwtRapCompatibilitySWT.java
new file mode 100644
index 0000000..5ae30c0
--- /dev/null
+++ b/org.eclipse.babel.editor.swt.compat/src/org/eclipse/babel/editor/compat/SwtRapCompatibilitySWT.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Matthias Lettmayer.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Matthias Lettmayer - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.babel.editor.compat;
+
+import org.eclipse.swt.SWT;
+
+public class SwtRapCompatibilitySWT extends SWT {
+
+}
diff --git a/org.eclipse.babel.editor.swt.compat/src/org/eclipse/babel/editor/swt/compat/Activator.java b/org.eclipse.babel.editor.swt.compat/src/org/eclipse/babel/editor/swt/compat/Activator.java
new file mode 100644
index 0000000..c771b3d
--- /dev/null
+++ b/org.eclipse.babel.editor.swt.compat/src/org/eclipse/babel/editor/swt/compat/Activator.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Matthias Lettmayer.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Matthias Lettmayer - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.babel.editor.swt.compat;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator implements BundleActivator {
+
+ private static BundleContext context;
+
+ static BundleContext getContext() {
+ return context;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext
+ * )
+ */
+ public void start(BundleContext bundleContext) throws Exception {
+ Activator.context = bundleContext;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext bundleContext) throws Exception {
+ Activator.context = null;
+ }
+
+}
diff --git a/org.eclipse.babel.editor.swt/.classpath b/org.eclipse.babel.editor.swt/.classpath
new file mode 100644
index 0000000..ad32c83
--- /dev/null
+++ b/org.eclipse.babel.editor.swt/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.eclipse.babel.editor.swt/.project b/org.eclipse.babel.editor.swt/.project
new file mode 100644
index 0000000..d35cf68
--- /dev/null
+++ b/org.eclipse.babel.editor.swt/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.babel.editor.swt</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.babel.editor.swt/META-INF/MANIFEST.MF b/org.eclipse.babel.editor.swt/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..fe12377
--- /dev/null
+++ b/org.eclipse.babel.editor.swt/META-INF/MANIFEST.MF
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: RCP fragment for the Babel Editor
+Bundle-SymbolicName: org.eclipse.babel.editor.swt;singleton:=true
+Bundle-Version: 0.8.0.qualifier
+Fragment-Host: org.eclipse.babel.editor;bundle-version="0.8.0"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Require-Bundle: org.eclipse.ltk.core.refactoring,
+ org.eclipse.ltk.ui.refactoring
+Export-Package: org.eclipse.babel.editor.internal
diff --git a/org.eclipse.babel.editor.swt/build.properties b/org.eclipse.babel.editor.swt/build.properties
new file mode 100644
index 0000000..e3023e1
--- /dev/null
+++ b/org.eclipse.babel.editor.swt/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ fragment.xml
diff --git a/org.eclipse.babel.editor.swt/fragment.xml b/org.eclipse.babel.editor.swt/fragment.xml
new file mode 100644
index 0000000..c619b03
--- /dev/null
+++ b/org.eclipse.babel.editor.swt/fragment.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<fragment>
+ <extension
+ point="org.eclipse.ui.handlers">
+ <handler
+ class="org.eclipse.babel.editor.refactoring.RefactoringHandler"
+ commandId="org.eclipse.babel.editor.command.refactoring">
+ </handler>
+ </extension>
+ <extension
+ point="org.eclipse.ui.commands">
+ <command
+ id="org.eclipse.babel.editor.command.refactoring"
+ name="Refactor...">
+ </command>
+ </extension>
+ <extension
+ point="org.eclipse.ui.bindings">
+ <key
+ commandId="org.eclipse.babel.editor.command.refactoring"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ sequence="M1+R">
+ </key>
+ </extension>
+</fragment>
diff --git a/org.eclipse.babel.editor.swt/pom.xml b/org.eclipse.babel.editor.swt/pom.xml
new file mode 100644
index 0000000..056e492
--- /dev/null
+++ b/org.eclipse.babel.editor.swt/pom.xml
@@ -0,0 +1,13 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.eclipse.babel.editor</groupId>
+ <artifactId>org.eclipse.babel.editor.swt</artifactId>
+ <version>0.8.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+ <parent>
+ <groupId>org.eclipse.babel.tapiji.tools</groupId>
+ <artifactId>org.eclipse.babel.tapiji.tools.parent</artifactId>
+ <version>0.0.2-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+</project> \ No newline at end of file
diff --git a/org.eclipse.babel.editor.swt/src/org/eclipse/babel/editor/i18n/I18NEntry.java b/org.eclipse.babel.editor.swt/src/org/eclipse/babel/editor/i18n/I18NEntry.java
new file mode 100644
index 0000000..09a3459
--- /dev/null
+++ b/org.eclipse.babel.editor.swt/src/org/eclipse/babel/editor/i18n/I18NEntry.java
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Pascal Essiembre, Alexej Strelow, Matthias Lettmayer.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Pascal Essiembre - initial API and implementation
+ * Alexej Strelzow - updateKey
+ * Matthias Lettmayer - extracted I18NEntry into own class for SWT specific implementation
+ ******************************************************************************/
+package org.eclipse.babel.editor.i18n;
+
+import java.util.Locale;
+
+import org.eclipse.babel.core.message.IMessage;
+import org.eclipse.babel.core.message.IMessagesBundleGroup;
+import org.eclipse.babel.core.util.BabelUtils;
+import org.eclipse.babel.editor.internal.AbstractMessagesEditor;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.widgets.Composite;
+
+public class I18NEntry extends AbstractI18NEntry {
+
+ public I18NEntry(Composite parent, AbstractMessagesEditor editor,
+ Locale locale) {
+ super(parent, editor, locale);
+ }
+
+ @Override
+ void updateKey(String key) {
+ IMessagesBundleGroup messagesBundleGroup = editor.getBundleGroup();
+ boolean isKey = key != null && messagesBundleGroup.isMessageKey(key);
+ textBox.setEnabled(isKey);
+ if (isKey) {
+ IMessage entry = messagesBundleGroup.getMessage(key, locale);
+ if (entry == null || entry.getValue() == null) {
+ textBox.setText(null);
+ // commentedCheckbox.setSelection(false);
+ } else {
+ // commentedCheckbox.setSelection(bundleEntry.isCommented());
+ textBox.setText(entry.getValue());
+ }
+ } else {
+ textBox.setText(null);
+ }
+ }
+
+ @Override
+ KeyListener getKeyListener() {
+ return new KeyAdapter() {
+ public void keyReleased(KeyEvent event) {
+ // Text field has changed: make editor dirty if not already
+ if (!BabelUtils.equals(focusGainedText, textBox.getText())) {
+ // Make the editor dirty if not already. If it is,
+ // we wait until field focus lost (or save) to
+ // update it completely.
+ if (!editor.isDirty()) {
+ // textEditor.isDirty();
+ updateModel();
+ // int caretPosition = eventBox.getCaretPosition();
+ // updateBundleOnChanges();
+ // eventBox.setSelection(caretPosition);
+ }
+ // autoDetectRequiredFont(eventBox.getText());
+ }
+ }
+ };
+ // Eric Fettweis : new listener to automatically change the font
+ // textBox.addModifyListener(new ModifyListener() {
+ //
+ // public void modifyText(ModifyEvent e) {
+ // String text = textBox.getText();
+ // Font f = textBox.getFont();
+ // String fontName = getBestFont(f.getFontData()[0].getName(), text);
+ // if(fontName!=null){
+ // f = getSWTFont(f, fontName);
+ // textBox.setFont(f);
+ // }
+ // }
+ //
+ // });
+ // }
+ }
+}
diff --git a/org.eclipse.babel.editor.swt/src/org/eclipse/babel/editor/internal/MessagesEditor.java b/org.eclipse.babel.editor.swt/src/org/eclipse/babel/editor/internal/MessagesEditor.java
new file mode 100644
index 0000000..a5203e6
--- /dev/null
+++ b/org.eclipse.babel.editor.swt/src/org/eclipse/babel/editor/internal/MessagesEditor.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Pascal Essiembre, Alexej Strelzow, Matthias Lettmayer.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Pascal Essiembre - initial API and implementation
+ * Alexej Strelzow - TapJI integration, bug fixes & enhancements
+ * - issue 35, 36, 48, 73
+ * Matthias Lettmayer - extracted messages editor into own class for SWT specific implementation
+ ******************************************************************************/
+
+package org.eclipse.babel.editor.internal;
+
+import org.eclipse.babel.core.message.internal.IMessagesBundleGroupListener;
+import org.eclipse.babel.core.message.internal.MessagesBundle;
+import org.eclipse.babel.core.message.internal.MessagesBundleGroupAdapter;
+import org.eclipse.ui.editors.text.TextEditor;
+import org.eclipse.ui.texteditor.ITextEditor;
+
+public class MessagesEditor extends AbstractMessagesEditor {
+
+ @Override
+ protected IMessagesBundleGroupListener getMsgBundleGroupListner() {
+ return new MessagesBundleGroupAdapter() {
+ @Override
+ public void messagesBundleAdded(MessagesBundle messagesBundle) {
+ addMessagesBundle(messagesBundle);
+ }
+ };
+ }
+
+ @Override
+ protected void initRAP() {
+ // nothing to do
+ }
+
+ @Override
+ protected void disposeRAP() {
+ // nothing to do
+ }
+
+ @Override
+ public void setEnabled(boolean enabled) {
+ i18nPage.setEnabled(enabled);
+ for (ITextEditor textEditor : textEditorsIndex) {
+ // TODO disable editors
+ }
+ }
+
+}
diff --git a/org.eclipse.babel.editor.swt/src/org/eclipse/babel/editor/refactoring/RefactoringHandler.java b/org.eclipse.babel.editor.swt/src/org/eclipse/babel/editor/refactoring/RefactoringHandler.java
new file mode 100644
index 0000000..81a6048
--- /dev/null
+++ b/org.eclipse.babel.editor.swt/src/org/eclipse/babel/editor/refactoring/RefactoringHandler.java
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Alexej Strelzow.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Alexej Strelzow - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.babel.editor.refactoring;
+
+import org.eclipse.babel.core.message.internal.MessagesBundleGroup;
+import org.eclipse.babel.core.message.manager.RBManager;
+import org.eclipse.babel.core.message.tree.internal.AbstractKeyTreeModel;
+import org.eclipse.babel.core.message.tree.internal.KeyTreeNode;
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jface.text.TextSelection;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.swt.widgets.Widget;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.ISelectionService;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.FileEditorInput;
+
+/**
+ * Handler for the key binding M1 (= Ctrl) + R. This handler triggers the
+ * refactoring process.
+ *
+ * @author Alexej Strelzow
+ */
+public class RefactoringHandler extends AbstractHandler {
+
+ /**
+ * Gets called if triggered
+ *
+ * @param event
+ * The {@link ExecutionEvent}
+ */
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+
+ Event e = ((Event) event.getTrigger());
+ Widget widget = e.widget;
+
+ ISelectionService selectionService = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getSelectionService();
+ ISelection selection = selectionService.getSelection();
+
+ if (selection instanceof TextSelection && widget instanceof StyledText) { // Java-File
+ TextSelection txtSel = (TextSelection) selection;
+ IEditorPart activeEditor = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getActivePage()
+ .getActiveEditor();
+ FileEditorInput input = (FileEditorInput) activeEditor
+ .getEditorInput();
+ IFile file = input.getFile();
+
+ RBManager.getRefactorService().openRefactorDialog(file,
+ txtSel.getOffset());
+ }
+
+ if (widget != null && widget instanceof Tree) { // Messages-Editor or
+ // TapiJI-View
+ Tree tree = (Tree) widget;
+ TreeItem[] treeItems = tree.getSelection();
+ if (treeItems.length == 1) {
+ TreeItem item = treeItems[0];
+ Object data = item.getData();
+ String oldKey = item.getText();
+ if (data != null && data instanceof KeyTreeNode) {
+ oldKey = ((KeyTreeNode)data).getMessageKey();
+ }
+ if (tree.getData() instanceof AbstractKeyTreeModel) {
+ AbstractKeyTreeModel model = (AbstractKeyTreeModel) tree
+ .getData();
+ MessagesBundleGroup messagesBundleGroup = model
+ .getMessagesBundleGroup();
+ String projectName = messagesBundleGroup.getProjectName();
+ String resourceBundleId = messagesBundleGroup
+ .getResourceBundleId();
+
+ RBManager.getRefactorService().openRefactorDialog(
+ projectName, resourceBundleId, oldKey, null);
+
+ }
+ }
+ }
+
+ return null;
+ }
+
+}
diff --git a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/refactoring/RenameKeyArguments.java b/org.eclipse.babel.editor.swt/src/org/eclipse/babel/editor/refactoring/RenameKeyArguments.java
index ba64796..ba64796 100644
--- a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/refactoring/RenameKeyArguments.java
+++ b/org.eclipse.babel.editor.swt/src/org/eclipse/babel/editor/refactoring/RenameKeyArguments.java
diff --git a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/refactoring/RenameKeyChange.java b/org.eclipse.babel.editor.swt/src/org/eclipse/babel/editor/refactoring/RenameKeyChange.java
index f30272e..f30272e 100644
--- a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/refactoring/RenameKeyChange.java
+++ b/org.eclipse.babel.editor.swt/src/org/eclipse/babel/editor/refactoring/RenameKeyChange.java
diff --git a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/refactoring/RenameKeyDescriptor.java b/org.eclipse.babel.editor.swt/src/org/eclipse/babel/editor/refactoring/RenameKeyDescriptor.java
index 168b618..168b618 100644
--- a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/refactoring/RenameKeyDescriptor.java
+++ b/org.eclipse.babel.editor.swt/src/org/eclipse/babel/editor/refactoring/RenameKeyDescriptor.java
diff --git a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/refactoring/RenameKeyProcessor.java b/org.eclipse.babel.editor.swt/src/org/eclipse/babel/editor/refactoring/RenameKeyProcessor.java
index d477287..d477287 100644
--- a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/refactoring/RenameKeyProcessor.java
+++ b/org.eclipse.babel.editor.swt/src/org/eclipse/babel/editor/refactoring/RenameKeyProcessor.java
diff --git a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/refactoring/RenameKeyWizard.java b/org.eclipse.babel.editor.swt/src/org/eclipse/babel/editor/refactoring/RenameKeyWizard.java
index 8cad851..8cad851 100644
--- a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/refactoring/RenameKeyWizard.java
+++ b/org.eclipse.babel.editor.swt/src/org/eclipse/babel/editor/refactoring/RenameKeyWizard.java
diff --git a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/tree/actions/RenameKeyAction.java b/org.eclipse.babel.editor.swt/src/org/eclipse/babel/editor/tree/actions/RenameKeyAction.java
index add1ff9..091b4c9 100644
--- a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/tree/actions/RenameKeyAction.java
+++ b/org.eclipse.babel.editor.swt/src/org/eclipse/babel/editor/tree/actions/RenameKeyAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Pascal Essiembre.
+ * Copyright (c) 2007 Pascal Essiembre, Matthias Lettmayer.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,38 +7,24 @@
*
* Contributors:
* Pascal Essiembre - initial API and implementation
+ * Matthias Lettmayer - extracted RenameKeyAction into own class for SWT specific implementation
******************************************************************************/
package org.eclipse.babel.editor.tree.actions;
import org.eclipse.babel.core.message.tree.internal.KeyTreeNode;
-import org.eclipse.babel.editor.internal.MessagesEditor;
-import org.eclipse.babel.editor.plugin.MessagesEditorPlugin;
+import org.eclipse.babel.editor.internal.AbstractMessagesEditor;
import org.eclipse.babel.editor.refactoring.RenameKeyProcessor;
import org.eclipse.babel.editor.refactoring.RenameKeyWizard;
-import org.eclipse.babel.editor.util.UIUtils;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.ltk.ui.refactoring.RefactoringWizard;
import org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation;
-/**
- * @author Pascal Essiembre
- *
- */
-public class RenameKeyAction extends AbstractTreeAction {
+public class RenameKeyAction extends AbstractRenameKeyAction {
- /**
- *
- */
- public RenameKeyAction(MessagesEditor editor, TreeViewer treeViewer) {
+ public RenameKeyAction(AbstractMessagesEditor editor, TreeViewer treeViewer) {
super(editor, treeViewer);
- setText(MessagesEditorPlugin.getString("key.rename") + " ..."); //$NON-NLS-1$
- setImageDescriptor(UIUtils.getImageDescriptor(UIUtils.IMAGE_RENAME));
- setToolTipText("TODO put something here"); // TODO put tooltip
}
- /**
- * @see org.eclipse.jface.action.Action#run()
- */
@Override
public void run() {
KeyTreeNode node = getNodeSelection();
diff --git a/org.eclipse.babel.editor/META-INF/MANIFEST.MF b/org.eclipse.babel.editor/META-INF/MANIFEST.MF
index 44f856c..faf215e 100644
--- a/org.eclipse.babel.editor/META-INF/MANIFEST.MF
+++ b/org.eclipse.babel.editor/META-INF/MANIFEST.MF
@@ -4,21 +4,30 @@ Bundle-Name: %plugin.name
Bundle-SymbolicName: org.eclipse.babel.editor;singleton:=true
Bundle-Version: 0.8.0.qualifier
Bundle-Activator: org.eclipse.babel.editor.plugin.MessagesEditorPlugin
-Require-Bundle: org.eclipse.ui,
+Require-Bundle: org.eclipse.ui;resolution:=optional,
+ org.eclipse.babel.editor.swt.compat;bundle-version="0.8.0";resolution:=optional,
org.eclipse.core.runtime,
- org.eclipse.jface.text,
- org.eclipse.ui.editors,
- org.eclipse.ui.ide,
- org.eclipse.ui.workbench.texteditor,
- org.eclipse.ui.views,
- org.eclipse.ui.forms;bundle-version="3.2.0",
+ org.eclipse.jface.text;resolution:=optional,
+ org.eclipse.ui.editors;resolution:=optional,
+ org.eclipse.babel.editor.rap.compat;bundle-version="0.8.0";resolution:=optional,
+ org.eclipse.ui.ide;resolution:=optional,
+ org.eclipse.ui.workbench.texteditor;resolution:=optional,
+ org.eclipse.ui.views;resolution:=optional,
org.eclipse.core.resources;bundle-version="3.2.0",
- org.eclipse.jdt.core;bundle-version="3.2.0",
- org.eclipse.ltk.core.refactoring,
- org.eclipse.ltk.ui.refactoring,
+ org.eclipse.jdt.core;bundle-version="3.2.0";resolution:=optional,
+ org.eclipse.ltk.core.refactoring;resolution:=optional,
+ org.eclipse.ltk.ui.refactoring;resolution:=optional,
org.junit;resolution:=optional,
- org.eclipse.babel.core;visibility:=reexport,
- org.eclipse.pde.core;resolution:=optional
+ org.eclipse.babel.core,
+ org.eclipse.pde.core;resolution:=optional,
+ org.eclipse.rap.ui;bundle-version="1.5.0";resolution:=optional,
+ org.eclipselabs.tapiji.translator.rap.supplemental;bundle-version="0.0.2";resolution:=optional,
+ org.eclipse.rap.ui.views;bundle-version="1.5.0";resolution:=optional,
+ org.eclipse.rap.rwt.supplemental.filedialog;bundle-version="1.5.0";resolution:=optional,
+ org.eclipse.rap.ui.forms;bundle-version="1.5.0";resolution:=optional,
+ org.eclipse.ui.forms;bundle-version="3.5.101";resolution:=optional,
+ org.eclipselabs.tapiji.translator.rap.model;bundle-version="0.0.2";resolution:=optional,
+ org.eclipselabs.tapiji.translator.rap.helpers;bundle-version="1.0.0";resolution:=optional
Bundle-ActivationPolicy: lazy
Bundle-Vendor: %plugin.provider
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
@@ -26,4 +35,6 @@ Bundle-Localization: plugin
Export-Package: org.eclipse.babel.editor,
org.eclipse.babel.editor.api,
org.eclipse.babel.editor.util,
+ org.eclipse.babel.editor.widgets,
org.eclipse.babel.editor.wizards
+Import-Package: org.eclipse.ui.forms.widgets
diff --git a/org.eclipse.babel.editor/build.properties b/org.eclipse.babel.editor/build.properties
index 232cb4e..fdad6ae 100644
--- a/org.eclipse.babel.editor/build.properties
+++ b/org.eclipse.babel.editor/build.properties
@@ -9,4 +9,5 @@ bin.includes = META-INF/,\
CHANGES
src.includes = icons/,\
messages.properties,\
- CHANGES
+ plugin.properties,\
+ plugin.xml
diff --git a/org.eclipse.babel.editor/icons/refactoring.png b/org.eclipse.babel.editor/icons/refactoring.png
index 0c435e5..5242fdf 100644
--- a/org.eclipse.babel.editor/icons/refactoring.png
+++ b/org.eclipse.babel.editor/icons/refactoring.png
Binary files differ
diff --git a/org.eclipse.babel.editor/messages.properties b/org.eclipse.babel.editor/messages.properties
index b2ef016..01f6ed1 100644
--- a/org.eclipse.babel.editor/messages.properties
+++ b/org.eclipse.babel.editor/messages.properties
@@ -65,6 +65,7 @@ key.expandAll = &Expand All
key.layout.flat = Flat
key.layout.tree = Tree
key.rename = &Rename
+key.refactor = Refactor
key.uncomment = &Uncomment
prefs.alignEquals = Align equal signs
diff --git a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/IMessagesEditor.java b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/IMessagesEditor.java
index 2286d30..9d397d4 100644
--- a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/IMessagesEditor.java
+++ b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/IMessagesEditor.java
@@ -10,8 +10,16 @@
******************************************************************************/
package org.eclipse.babel.editor;
+import org.eclipse.babel.core.message.internal.MessagesBundleGroup;
+
public interface IMessagesEditor {
String getSelectedKey();
void setSelectedKey(String key);
+
+ MessagesBundleGroup getBundleGroup();
+
+ void setTitleName(String string);
+
+ void setEnabled(boolean enabled);
}
diff --git a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/actions/FilterKeysAction.java b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/actions/FilterKeysAction.java
index 1d1fc41..4c2274d 100644
--- a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/actions/FilterKeysAction.java
+++ b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/actions/FilterKeysAction.java
@@ -11,7 +11,7 @@
package org.eclipse.babel.editor.actions;
import org.eclipse.babel.editor.IMessagesEditorChangeListener;
-import org.eclipse.babel.editor.internal.MessagesEditor;
+import org.eclipse.babel.editor.internal.AbstractMessagesEditor;
import org.eclipse.babel.editor.internal.MessagesEditorChangeAdapter;
import org.eclipse.babel.editor.internal.MessagesEditorContributor;
import org.eclipse.babel.editor.util.UIUtils;
@@ -26,7 +26,7 @@ import org.eclipse.swt.graphics.Image;
*/
public class FilterKeysAction extends Action {
- private MessagesEditor editor;
+ private AbstractMessagesEditor editor;
private final int flagToSet;
private ChangeListener listener;
@@ -144,7 +144,7 @@ public class FilterKeysAction extends Action {
// }
}
- public void setEditor(MessagesEditor editor) {
+ public void setEditor(AbstractMessagesEditor editor) {
if (editor == this.editor) {
return;// no change
}
diff --git a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/actions/KeyTreeVisibleAction.java b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/actions/KeyTreeVisibleAction.java
index ed8eff7..b5740ef 100644
--- a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/actions/KeyTreeVisibleAction.java
+++ b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/actions/KeyTreeVisibleAction.java
@@ -10,7 +10,7 @@
******************************************************************************/
package org.eclipse.babel.editor.actions;
-import org.eclipse.babel.editor.internal.MessagesEditor;
+import org.eclipse.babel.editor.internal.AbstractMessagesEditor;
import org.eclipse.babel.editor.internal.MessagesEditorChangeAdapter;
import org.eclipse.babel.editor.util.UIUtils;
import org.eclipse.jface.action.Action;
@@ -22,7 +22,7 @@ import org.eclipse.jface.action.IAction;
*/
public class KeyTreeVisibleAction extends Action {
- private MessagesEditor editor;
+ private AbstractMessagesEditor editor;
/**
*
@@ -36,7 +36,7 @@ public class KeyTreeVisibleAction extends Action {
// TODO RBEditor hold such an action registry. Then move this method to
// constructor
- public void setEditor(MessagesEditor editor) {
+ public void setEditor(AbstractMessagesEditor editor) {
this.editor = editor;
editor.addChangeListener(new MessagesEditorChangeAdapter() {
public void keyTreeVisibleChanged(boolean visible) {
diff --git a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/actions/NewLocaleAction.java b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/actions/NewLocaleAction.java
index bc4ff39..25f76ab 100644
--- a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/actions/NewLocaleAction.java
+++ b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/actions/NewLocaleAction.java
@@ -14,7 +14,7 @@ package org.eclipse.babel.editor.actions;
import java.util.Locale;
import org.eclipse.babel.core.message.internal.MessagesBundleGroup;
-import org.eclipse.babel.editor.internal.MessagesEditor;
+import org.eclipse.babel.editor.internal.AbstractMessagesEditor;
import org.eclipse.babel.editor.util.UIUtils;
import org.eclipse.babel.editor.widgets.LocaleSelector;
import org.eclipse.jface.action.Action;
@@ -29,7 +29,7 @@ import org.eclipse.swt.widgets.Shell;
*/
public class NewLocaleAction extends Action {
- private MessagesEditor editor;
+ private AbstractMessagesEditor editor;
/**
*
@@ -43,7 +43,7 @@ public class NewLocaleAction extends Action {
// TODO RBEditor hold such an action registry. Then move this method to
// constructor
- public void setEditor(MessagesEditor editor) {
+ public void setEditor(AbstractMessagesEditor editor) {
this.editor = editor;
}
diff --git a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/api/EditorUtil.java b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/api/EditorUtil.java
index 88ed83f..980b364 100644
--- a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/api/EditorUtil.java
+++ b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/api/EditorUtil.java
@@ -2,7 +2,7 @@ package org.eclipse.babel.editor.api;
import org.eclipse.babel.core.message.tree.IKeyTreeNode;
import org.eclipse.babel.editor.i18n.I18NPage;
-import org.eclipse.babel.editor.internal.MessagesEditor;
+import org.eclipse.babel.editor.internal.AbstractMessagesEditor;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IWorkbenchPage;
@@ -21,7 +21,8 @@ public class EditorUtil {
* @return The selected {@link IKeyTreeNode} of the page.
*/
public static IKeyTreeNode getSelectedKeyTreeNode(IWorkbenchPage page) {
- MessagesEditor editor = (MessagesEditor) page.getActiveEditor();
+ AbstractMessagesEditor editor = (AbstractMessagesEditor) page
+ .getActiveEditor();
if (editor.getSelectedPage() instanceof I18NPage) {
I18NPage p = (I18NPage) editor.getSelectedPage();
ISelection selection = p.getSelection();
diff --git a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/i18n/I18NEntry.java b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/i18n/AbstractI18NEntry.java
index 79e865c..f05d8b5 100644..100755
--- a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/i18n/I18NEntry.java
+++ b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/i18n/AbstractI18NEntry.java
@@ -19,16 +19,19 @@ import org.eclipse.babel.core.message.IMessagesBundleGroup;
import org.eclipse.babel.core.message.internal.Message;
import org.eclipse.babel.core.message.manager.RBManager;
import org.eclipse.babel.core.util.BabelUtils;
-import org.eclipse.babel.editor.internal.MessagesEditor;
+import org.eclipse.babel.editor.IMessagesEditorChangeListener;
+import org.eclipse.babel.editor.internal.AbstractMessagesEditor;
import org.eclipse.babel.editor.internal.MessagesEditorChangeAdapter;
import org.eclipse.babel.editor.util.UIUtils;
import org.eclipse.babel.editor.widgets.NullableText;
+import org.eclipse.jface.bindings.keys.IKeyLookup;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CBanner;
import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.FocusListener;
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
import org.eclipse.swt.events.TraverseEvent;
import org.eclipse.swt.events.TraverseListener;
import org.eclipse.swt.layout.GridData;
@@ -42,17 +45,25 @@ import org.eclipse.ui.editors.text.TextEditor;
*
* @author Pascal Essiembre
*/
-public class I18NEntry extends Composite {
+public abstract class AbstractI18NEntry extends Composite {
- private final MessagesEditor editor;
+ protected final AbstractMessagesEditor editor;
private final String bundleGroupId;
private final String projectName;
- private final Locale locale;
+ protected final Locale locale;
private boolean expanded = true;
- private NullableText textBox;
+ protected NullableText textBox;
private CBanner banner;
- private String focusGainedText;
+ protected String focusGainedText;
+
+ public static final String INSTANCE_CLASS = "org.eclipse.babel.editor.i18n.I18NEntry";
+
+ private IMessagesEditorChangeListener msgEditorUpdateKey = new MessagesEditorChangeAdapter() {
+ public void selectedKeyChanged(String oldKey, String newKey) {
+ updateKey(newKey);
+ }
+ };
/**
* Constructor.
@@ -62,8 +73,8 @@ public class I18NEntry extends Composite {
* @param keyTree
* key tree
*/
- public I18NEntry(Composite parent, final MessagesEditor editor,
- final Locale locale) {
+ public AbstractI18NEntry(Composite parent,
+ final AbstractMessagesEditor editor, final Locale locale) {
super(parent, SWT.NONE);
this.editor = editor;
this.locale = locale;
@@ -100,7 +111,7 @@ public class I18NEntry extends Composite {
}
- public MessagesEditor getResourceBundleEditor() {
+ public AbstractMessagesEditor getResourceBundleEditor() {
return editor;
}
@@ -150,15 +161,13 @@ public class I18NEntry extends Composite {
}
public boolean isEditable() {
- IMessagesBundleGroup messagesBundleGroup = RBManager.getInstance(
- projectName).getMessagesBundleGroup(bundleGroupId);
+ IMessagesBundleGroup messagesBundleGroup = editor.getBundleGroup();
IMessagesBundle bundle = messagesBundleGroup.getMessagesBundle(locale);
return ((TextEditor) bundle.getResource().getSource()).isEditable();
}
public String getResourceLocationLabel() {
- IMessagesBundleGroup messagesBundleGroup = RBManager.getInstance(
- projectName).getMessagesBundleGroup(bundleGroupId);
+ IMessagesBundleGroup messagesBundleGroup = editor.getBundleGroup();
IMessagesBundle bundle = messagesBundleGroup.getMessagesBundle(locale);
return bundle.getResource().getResourceLocationLabel();
}
@@ -204,72 +213,22 @@ public class I18NEntry extends Composite {
});
// Handle dirtyness
- textBox.addKeyListener(new KeyAdapter() {
- public void keyReleased(KeyEvent event) {
- // Text field has changed: make editor dirty if not already
- if (!BabelUtils.equals(focusGainedText, textBox.getText())) {
- // Make the editor dirty if not already. If it is,
- // we wait until field focus lost (or save) to
- // update it completely.
- if (!editor.isDirty()) {
- // textEditor.isDirty();
- updateModel();
- // int caretPosition = eventBox.getCaretPosition();
- // updateBundleOnChanges();
- // eventBox.setSelection(caretPosition);
- }
- // autoDetectRequiredFont(eventBox.getText());
- }
- }
- });
- // // Eric Fettweis : new listener to automatically change the font
- // textBox.addModifyListener(new ModifyListener() {
- //
- // public void modifyText(ModifyEvent e) {
- // String text = textBox.getText();
- // Font f = textBox.getFont();
- // String fontName = getBestFont(f.getFontData()[0].getName(), text);
- // if(fontName!=null){
- // f = getSWTFont(f, fontName);
- // textBox.setFont(f);
- // }
- // }
- //
- // });
-
- editor.addChangeListener(new MessagesEditorChangeAdapter() {
- public void selectedKeyChanged(String oldKey, String newKey) {
- updateKey(newKey);
- }
- });
+ textBox.addKeyListener(getKeyListener());
+ editor.addChangeListener(msgEditorUpdateKey);
}
- void updateKey(String key) {
- IMessagesBundleGroup messagesBundleGroup = RBManager.getInstance(
- projectName).getMessagesBundleGroup(bundleGroupId);
- boolean isKey = key != null && messagesBundleGroup.isMessageKey(key);
- textBox.setEnabled(isKey);
- if (isKey) {
- IMessage entry = messagesBundleGroup.getMessage(key, locale);
- if (entry == null || entry.getValue() == null) {
- textBox.setText(null);
- // commentedCheckbox.setSelection(false);
- } else {
- // commentedCheckbox.setSelection(bundleEntry.isCommented());
- textBox.setText(entry.getValue());
- }
- } else {
- textBox.setText(null);
- }
- }
+ abstract void updateKey(String key);
- private void updateModel() {
+ abstract KeyListener getKeyListener();
+
+ protected void updateModel() {
if (editor.getSelectedKey() != null) {
if (!BabelUtils.equals(focusGainedText, textBox.getText())) {
- IMessagesBundleGroup messagesBundleGroup = RBManager
- .getInstance(projectName).getMessagesBundleGroup(
- bundleGroupId);
+ // IMessagesBundleGroup messagesBundleGroup =
+ // RBManager.getInstance(projectName).getMessagesBundleGroup(bundleGroupId);
+ IMessagesBundleGroup messagesBundleGroup = editor
+ .getBundleGroup();
String key = editor.getSelectedKey();
IMessage entry = messagesBundleGroup.getMessage(key, locale);
if (entry == null) {
@@ -284,6 +243,19 @@ public class I18NEntry extends Composite {
}
}
}
+
+ @Override
+ public void setEnabled(boolean enabled) {
+ super.setEnabled(enabled);
+ textBox.setEnabled(enabled);
+ }
+
+ @Override
+ public void dispose() {
+ editor.removeChangeListener(msgEditorUpdateKey);
+ super.dispose();
+ }
+
}
// TODO Grab and Apply font fix:
diff --git a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/i18n/EntryLeftBanner.java b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/i18n/EntryLeftBanner.java
index a32a9c9..c0e17bf 100644
--- a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/i18n/EntryLeftBanner.java
+++ b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/i18n/EntryLeftBanner.java
@@ -41,7 +41,7 @@ public class EntryLeftBanner extends Composite {
* @param keyTree
* key tree
*/
- public EntryLeftBanner(Composite parent, final I18NEntry i18NEntry) {
+ public EntryLeftBanner(Composite parent, final AbstractI18NEntry i18NEntry) {
super(parent, SWT.NONE);
RowLayout layout = new RowLayout();
diff --git a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/i18n/EntryRightBanner.java b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/i18n/EntryRightBanner.java
index e13feb7..e1981e7 100644
--- a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/i18n/EntryRightBanner.java
+++ b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/i18n/EntryRightBanner.java
@@ -20,15 +20,17 @@ import java.util.Observer;
import org.eclipse.babel.core.message.checks.IMessageCheck;
import org.eclipse.babel.core.message.checks.internal.DuplicateValueCheck;
import org.eclipse.babel.core.message.checks.internal.MissingValueCheck;
+import org.eclipse.babel.editor.IMessagesEditorChangeListener;
import org.eclipse.babel.editor.i18n.actions.ShowDuplicateAction;
import org.eclipse.babel.editor.i18n.actions.ShowMissingAction;
-import org.eclipse.babel.editor.internal.MessagesEditor;
+import org.eclipse.babel.editor.internal.AbstractMessagesEditor;
import org.eclipse.babel.editor.internal.MessagesEditorChangeAdapter;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PlatformUI;
@@ -44,9 +46,19 @@ public class EntryRightBanner extends Composite {
private Label warningIcon;
private final Map actionByMarkerIds = new HashMap();
private final ToolBarManager toolBarMgr = new ToolBarManager(SWT.FLAT);
- private final MessagesEditor editor;
- private final I18NEntry i18nEntry;
+ private final AbstractMessagesEditor editor;
+ private final AbstractI18NEntry i18nEntry;
private final Locale locale;
+ private final Observer observer = new Observer() {
+ public void update(Observable o, Object arg) {
+ updateMarkers();
+ }
+ };
+ private final IMessagesEditorChangeListener msgEditorChangeListener = new MessagesEditorChangeAdapter() {
+ public void selectedKeyChanged(String oldKey, String newKey) {
+ updateMarkers();
+ }
+ };
/**
* Constructor.
@@ -56,7 +68,7 @@ public class EntryRightBanner extends Composite {
* @param keyTree
* key tree
*/
- public EntryRightBanner(Composite parent, final I18NEntry i18nEntry) {
+ public EntryRightBanner(Composite parent, final AbstractI18NEntry i18nEntry) {
super(parent, SWT.NONE);
this.i18nEntry = i18nEntry;
this.locale = i18nEntry.getLocale();
@@ -82,17 +94,8 @@ public class EntryRightBanner extends Composite {
toolBarMgr.createControl(this);
toolBarMgr.update(true);
- editor.addChangeListener(new MessagesEditorChangeAdapter() {
- public void selectedKeyChanged(String oldKey, String newKey) {
- updateMarkers();
-
- }
- });
- editor.getMarkers().addObserver(new Observer() {
- public void update(Observable o, Object arg) {
- updateMarkers();
- }
- });
+ editor.addChangeListener(msgEditorChangeListener);
+ editor.getMarkers().addObserver(observer);
}
/**
@@ -100,8 +103,13 @@ public class EntryRightBanner extends Composite {
* @param colon
*/
private void updateMarkers() {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
+ Display display = toolBarMgr.getControl().getDisplay();
+ // [RAP] only update markers, which belong to this UIThread
+ if (display.equals(Display.getCurrent()) && !isDisposed()) {
+ display.asyncExec(new Runnable() {
public void run() {
+ if (isDisposed())
+ return;
// if (!PlatformUI.getWorkbench().getDisplay().isDisposed()
// && !editor.getMarkerManager().isDisposed()) {
boolean isMarked = false;
@@ -129,6 +137,7 @@ public class EntryRightBanner extends Composite {
}
// }
});
+ }
}
@@ -143,4 +152,10 @@ public class EntryRightBanner extends Composite {
return null;
}
+ @Override
+ public void dispose() {
+ editor.removeChangeListener(msgEditorChangeListener);
+ editor.getMarkers().deleteObserver(observer);
+ super.dispose();
+ }
}
diff --git a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/i18n/I18NPage.java b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/i18n/I18NPage.java
index c6a8bf1..ae4ab20 100644
--- a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/i18n/I18NPage.java
+++ b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/i18n/I18NPage.java
@@ -11,6 +11,7 @@
******************************************************************************/
package org.eclipse.babel.editor.i18n;
+import java.lang.reflect.Constructor;
import java.util.Collection;
import java.util.HashMap;
import java.util.Locale;
@@ -20,8 +21,9 @@ import org.eclipse.babel.core.message.IMessagesBundle;
import org.eclipse.babel.core.message.manager.IMessagesEditorListener;
import org.eclipse.babel.core.message.manager.RBManager;
import org.eclipse.babel.editor.IMessagesEditorChangeListener;
-import org.eclipse.babel.editor.internal.MessagesEditor;
+import org.eclipse.babel.editor.internal.AbstractMessagesEditor;
import org.eclipse.babel.editor.internal.MessagesEditorChangeAdapter;
+import org.eclipse.babel.editor.tree.actions.AbstractRenameKeyAction;
import org.eclipse.babel.editor.util.UIUtils;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
@@ -31,8 +33,10 @@ import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.custom.ScrolledComposite;
+import org.eclipse.swt.events.KeyListener;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IPartListener;
import org.eclipse.ui.IWorkbenchPart;
@@ -47,10 +51,10 @@ public class I18NPage extends ScrolledComposite implements ISelectionProvider {
/** Minimum height of text fields. */
private static final int TEXT_MIN_HEIGHT = 90;
- private final MessagesEditor editor;
- private final SideNavComposite keysComposite;
+ protected final AbstractMessagesEditor editor;
+ protected final SideNavComposite keysComposite;
private final Composite valuesComposite;
- private final Map<Locale, I18NEntry> entryComposites = new HashMap<Locale, I18NEntry>();
+ private final Map<Locale, AbstractI18NEntry> entryComposites = new HashMap<Locale, AbstractI18NEntry>();
private Composite entriesComposite;
// private Composite parent;
@@ -69,7 +73,8 @@ public class I18NPage extends ScrolledComposite implements ISelectionProvider {
* @param resourceMediator
* resource manager
*/
- public I18NPage(Composite parent, int style, final MessagesEditor editor) {
+ public I18NPage(Composite parent, int style,
+ final AbstractMessagesEditor editor) {
super(parent, style);
this.editor = editor;
sashForm = new SashForm(this, SWT.SMOOTH);
@@ -127,13 +132,21 @@ public class I18NPage extends ScrolledComposite implements ISelectionProvider {
}
public void onResourceChanged(IMessagesBundle bundle) {
- I18NEntry i18nEntry = entryComposites.get(bundle.getLocale());
+ // [RAP] only update tree, which belongs to this UIThread
+ if (!keysComposite.isDisposed()) {
+ Display display = keysComposite.getTreeViewer().getTree()
+ .getDisplay();
+ if (display.equals(Display.getCurrent())) {
+ AbstractI18NEntry i18nEntry = entryComposites.get(bundle
+ .getLocale());
if (i18nEntry != null && !getSelection().isEmpty()) {
i18nEntry.updateKey(String
.valueOf(((IStructuredSelection) getSelection())
.getFirstElement()));
}
}
+ }
+ }
});
}
@@ -181,7 +194,7 @@ public class I18NPage extends ScrolledComposite implements ISelectionProvider {
locales = UIUtils.filterLocales(locales);
for (int i = 0; i < locales.length; i++) {
Locale locale = locales[i];
- addI18NEntry(editor, locale);
+ addI18NEntry(locale);
}
editor.addChangeListener(new MessagesEditorChangeAdapter() {
@@ -195,17 +208,35 @@ public class I18NPage extends ScrolledComposite implements ISelectionProvider {
return scrolledComposite;
}
- public void addI18NEntry(MessagesEditor editor, Locale locale) {
- I18NEntry i18NEntry = new I18NEntry(entriesComposite, editor, locale);
+ public void addI18NEntry(Locale locale) {
+ AbstractI18NEntry i18NEntry = null;
+ try {
+ Class<?> clazz = Class.forName(AbstractI18NEntry.INSTANCE_CLASS);
+ Constructor<?> cons = clazz.getConstructor(Composite.class,
+ AbstractMessagesEditor.class, Locale.class);
+ i18NEntry = (AbstractI18NEntry) cons.newInstance(entriesComposite,
+ editor, locale);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
// entryComposite.addFocusListener(localBehaviour);
entryComposites.put(locale, i18NEntry);
entriesComposite.layout();
}
+ public void removeI18NEntry(Locale locale) {
+ AbstractI18NEntry i18NEntry = entryComposites.get(locale);
+ if (i18NEntry != null) {
+ i18NEntry.dispose();
+ entryComposites.remove(locale);
+ entriesComposite.layout();
+ }
+ }
+
public void selectLocale(Locale locale) {
Collection<Locale> locales = entryComposites.keySet();
for (Locale entryLocale : locales) {
- I18NEntry entry = entryComposites.get(entryLocale);
+ AbstractI18NEntry entry = entryComposites.get(entryLocale);
// TODO add equivalent method on entry composite
// Text textBox = entry.getTextBox();
@@ -239,4 +270,26 @@ public class I18NPage extends ScrolledComposite implements ISelectionProvider {
public TreeViewer getTreeViewer() {
return keysComposite.getTreeViewer();
}
+
+ @Override
+ public void setEnabled(boolean enabled) {
+ super.setEnabled(enabled);
+ for (AbstractI18NEntry entry : entryComposites.values())
+ entry.setEnabled(enabled);
+ }
+
+ public void setEnabled(boolean enabled, Locale locale) {
+ // super.setEnabled(enabled);
+ for (AbstractI18NEntry entry : entryComposites.values()) {
+ if (locale == entry.getLocale()
+ || (locale != null && locale.equals(entry.getLocale()))) {
+ entry.setEnabled(enabled);
+ break;
+ }
+ }
+ }
+
+ public SideNavTextBoxComposite getSidNavTextBoxComposite() {
+ return keysComposite.getSidNavTextBoxComposite();
+ }
}
diff --git a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/i18n/SideNavComposite.java b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/i18n/SideNavComposite.java
index a71649e..86b9265 100644
--- a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/i18n/SideNavComposite.java
+++ b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/i18n/SideNavComposite.java
@@ -10,7 +10,7 @@
******************************************************************************/
package org.eclipse.babel.editor.i18n;
-import org.eclipse.babel.editor.internal.MessagesEditor;
+import org.eclipse.babel.editor.internal.AbstractMessagesEditor;
import org.eclipse.babel.editor.tree.actions.CollapseAllAction;
import org.eclipse.babel.editor.tree.actions.ExpandAllAction;
import org.eclipse.babel.editor.tree.actions.FlatModelAction;
@@ -35,7 +35,9 @@ public class SideNavComposite extends Composite {
/** Key Tree Viewer. */
private TreeViewer treeViewer;
- private MessagesEditor editor;
+ private AbstractMessagesEditor editor;
+
+ private SideNavTextBoxComposite textBoxComp;
/**
* Constructor.
@@ -45,7 +47,8 @@ public class SideNavComposite extends Composite {
* @param keyTree
* key tree
*/
- public SideNavComposite(Composite parent, final MessagesEditor editor) {
+ public SideNavComposite(Composite parent,
+ final AbstractMessagesEditor editor) {
super(parent, SWT.BORDER);
this.editor = editor;
@@ -77,7 +80,7 @@ public class SideNavComposite extends Composite {
// createTopSection();
createKeyTree();
- new SideNavTextBoxComposite(this, editor);
+ textBoxComp = new SideNavTextBoxComposite(this, editor);
}
// private void initListener() {
@@ -128,4 +131,7 @@ public class SideNavComposite extends Composite {
}
+ public SideNavTextBoxComposite getSidNavTextBoxComposite() {
+ return textBoxComp;
+ }
}
diff --git a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/i18n/SideNavTextBoxComposite.java b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/i18n/SideNavTextBoxComposite.java
index 15b5163..b5cdae1 100644
--- a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/i18n/SideNavTextBoxComposite.java
+++ b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/i18n/SideNavTextBoxComposite.java
@@ -12,7 +12,7 @@ package org.eclipse.babel.editor.i18n;
import org.eclipse.babel.core.message.tree.IKeyTreeNode;
import org.eclipse.babel.core.message.tree.visitor.NodePathRegexVisitor;
-import org.eclipse.babel.editor.internal.MessagesEditor;
+import org.eclipse.babel.editor.internal.AbstractMessagesEditor;
import org.eclipse.babel.editor.internal.MessagesEditorChangeAdapter;
import org.eclipse.babel.editor.plugin.MessagesEditorPlugin;
import org.eclipse.swt.SWT;
@@ -40,8 +40,8 @@ public class SideNavTextBoxComposite extends Composite {
/** Text box to add a new key. */
private Text addTextBox;
-
- private MessagesEditor editor;
+ private Button addButton;
+ private AbstractMessagesEditor editor;
/**
* Constructor.
@@ -51,7 +51,8 @@ public class SideNavTextBoxComposite extends Composite {
* @param keyTree
* key tree
*/
- public SideNavTextBoxComposite(Composite parent, final MessagesEditor editor) {
+ public SideNavTextBoxComposite(Composite parent,
+ final AbstractMessagesEditor editor) {
super(parent, SWT.NONE);
this.editor = editor;
@@ -76,7 +77,7 @@ public class SideNavTextBoxComposite extends Composite {
addTextBox.setLayoutData(gridData);
// Add button
- final Button addButton = new Button(this, SWT.PUSH);
+ addButton = new Button(this, SWT.PUSH);
addButton.setText(MessagesEditorPlugin.getString("key.add")); //$NON-NLS-1$
addButton.setEnabled(false);
addButton.addSelectionListener(new SelectionAdapter() {
@@ -126,4 +127,10 @@ public class SideNavTextBoxComposite extends Composite {
private boolean isNewKey(String key) {
return !editor.getBundleGroup().isMessageKey(key) && key.length() > 0;
}
+
+ @Override
+ public void setEnabled(boolean enabled) {
+ super.setEnabled(enabled);
+ addButton.setEnabled(enabled);
+ }
}
diff --git a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/i18n/actions/FoldingAction.java b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/i18n/actions/FoldingAction.java
index 00cb990..f32e4db 100644
--- a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/i18n/actions/FoldingAction.java
+++ b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/i18n/actions/FoldingAction.java
@@ -10,7 +10,7 @@
******************************************************************************/
package org.eclipse.babel.editor.i18n.actions;
-import org.eclipse.babel.editor.i18n.I18NEntry;
+import org.eclipse.babel.editor.i18n.AbstractI18NEntry;
import org.eclipse.babel.editor.util.UIUtils;
import org.eclipse.jface.action.Action;
@@ -20,13 +20,13 @@ import org.eclipse.jface.action.Action;
*/
public class FoldingAction extends Action {
- private final I18NEntry i18NEntry;
+ private final AbstractI18NEntry i18NEntry;
private boolean expanded;
/**
*
*/
- public FoldingAction(I18NEntry i18NEntry) {
+ public FoldingAction(AbstractI18NEntry i18NEntry) {
super();
this.i18NEntry = i18NEntry;
this.expanded = i18NEntry.getExpanded();
diff --git a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/internal/MessagesEditor.java b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/internal/AbstractMessagesEditor.java
index 59bdf5b..75a72ea 100644..100755
--- a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/internal/MessagesEditor.java
+++ b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/internal/AbstractMessagesEditor.java
@@ -8,7 +8,7 @@
* Contributors:
* Pascal Essiembre - initial API and implementation
* Alexej Strelzow - TapJI integration, bug fixes & enhancements
- * - issue 35, 36, 48, 73
+ * - issue 35, 36, 48, 73
******************************************************************************/
package org.eclipse.babel.editor.internal;
@@ -21,6 +21,8 @@ import java.util.List;
import java.util.Locale;
import org.eclipse.babel.core.message.IMessagesBundle;
+import org.eclipse.babel.core.message.internal.IMessagesBundleGroupListener;
+import org.eclipse.babel.core.message.internal.IMessagesBundleListener;
import org.eclipse.babel.core.message.internal.MessageException;
import org.eclipse.babel.core.message.internal.MessagesBundle;
import org.eclipse.babel.core.message.internal.MessagesBundleGroup;
@@ -47,6 +49,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IEditorReference;
@@ -65,38 +68,38 @@ import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
/**
* Multi-page editor for editing resource bundles.
*/
-public class MessagesEditor extends MultiPageEditorPart implements IGotoMarker,
- IMessagesEditor {
+public abstract class AbstractMessagesEditor extends MultiPageEditorPart
+ implements IGotoMarker, IMessagesEditor {
/** Editor ID, as defined in plugin.xml. */
public static final String EDITOR_ID = "org.eclilpse.babel.editor.editor.MessagesEditor"; //$NON-NLS-1$
- private String selectedKey;
- private List<IMessagesEditorChangeListener> changeListeners = new ArrayList<IMessagesEditorChangeListener>(
+ protected String selectedKey;
+ protected List<IMessagesEditorChangeListener> changeListeners = new ArrayList<IMessagesEditorChangeListener>(
2);
/** MessagesBundle group. */
- private MessagesBundleGroup messagesBundleGroup;
+ protected MessagesBundleGroup messagesBundleGroup;
/** Page with key tree and text fields for all locales. */
- private I18NPage i18nPage;
- private final List<Locale> localesIndex = new ArrayList<Locale>();
- private final List<ITextEditor> textEditorsIndex = new ArrayList<ITextEditor>();
+ protected I18NPage i18nPage;
+ protected final List<Locale> localesIndex = new ArrayList<Locale>();
+ protected final List<ITextEditor> textEditorsIndex = new ArrayList<ITextEditor>();
- private MessagesBundleGroupOutline outline;
+ protected MessagesBundleGroupOutline outline;
- private MessagesEditorMarkers markers;
+ protected MessagesEditorMarkers markers;
- private AbstractKeyTreeModel keyTreeModel;
+ protected AbstractKeyTreeModel keyTreeModel;
- private IFile file; // init
+ protected IFile file; // init
- private boolean updateSelectedKey;
+ protected boolean updateSelectedKey;
/**
* Creates a multi-page editor example.
*/
- public MessagesEditor() {
+ public AbstractMessagesEditor() {
super();
outline = new MessagesBundleGroupOutline(this);
}
@@ -131,20 +134,8 @@ public class MessagesEditor extends MultiPageEditorPart implements IGotoMarker,
} catch (MessageException e) {
throw new PartInitException("Cannot create bundle group.", e); //$NON-NLS-1$
}
- // register bundle group listener to refresh editor when new a
- // bundle is added
messagesBundleGroup
- .addMessagesBundleGroupListener(new MessagesBundleGroupAdapter() {
- @Override
- public void messagesBundleAdded(
- MessagesBundle messagesBundle) {
- addMessagesBundle(messagesBundle,
- messagesBundle.getLocale());
- // refresh i18n page
- i18nPage.addI18NEntry(MessagesEditor.this,
- messagesBundle.getLocale());
- }
- });
+ .addMessagesBundleGroupListener(getMsgBundleGroupListner());
markers = new MessagesEditorMarkers(messagesBundleGroup);
setPartName(messagesBundleGroup.getName());
setTitleImage(UIUtils.getImage(UIUtils.IMAGE_RESOURCE_BUNDLE));
@@ -157,6 +148,7 @@ public class MessagesEditor extends MultiPageEditorPart implements IGotoMarker,
throw new PartInitException(
"Invalid Input: Must be IFileEditorInput"); //$NON-NLS-1$
}
+ initRAP();
}
// public RBEMarkerManager getMarkerManager() {
@@ -184,24 +176,23 @@ public class MessagesEditor extends MultiPageEditorPart implements IGotoMarker,
Locale locale = locales[i];
MessagesBundle messagesBundle = (MessagesBundle) messagesBundleGroup
.getMessagesBundle(locale);
- addMessagesBundle(messagesBundle, locale);
+ createMessagesBundlePage(messagesBundle);
}
}
/**
- * Creates a new text editor for the messages bundle and locale, which gets
- * added to a new page
+ * Creates a new text editor for the messages bundle, which gets added to a new page
*/
- private void addMessagesBundle(MessagesBundle messagesBundle, Locale locale) {
+ protected void createMessagesBundlePage(MessagesBundle messagesBundle) {
try {
IMessagesResource resource = messagesBundle.getResource();
- TextEditor textEditor = (TextEditor) resource.getSource();
+ final TextEditor textEditor = (TextEditor) resource.getSource();
int index = addPage(textEditor, textEditor.getEditorInput());
setPageText(index,
UIUtils.getDisplayName(messagesBundle.getLocale()));
setPageImage(index, UIUtils.getImage(UIUtils.IMAGE_PROPERTIES_FILE));
- localesIndex.add(locale);
- textEditorsIndex.add(textEditor);
+ localesIndex.add(messagesBundle.getLocale());
+ textEditorsIndex.add(textEditor);
} catch (PartInitException e) {
ErrorDialog.openError(getSite().getShell(),
"Error creating text editor page.", //$NON-NLS-1$
@@ -210,6 +201,34 @@ public class MessagesEditor extends MultiPageEditorPart implements IGotoMarker,
}
/**
+ * Adds a new messages bundle to an opened messages editor. Creates a new text edtor page
+ * and a new entry in the i18n page for the given locale and messages bundle.
+ */
+ protected void addMessagesBundle(MessagesBundle messagesBundle) {
+ createMessagesBundlePage(messagesBundle);
+ i18nPage.addI18NEntry(messagesBundle.getLocale());
+ }
+
+ /**
+ * Removes the text editor page + the entry from the i18n page of the given locale and messages bundle.
+ */
+ protected void removeMessagesBundle(MessagesBundle messagesBundle) {
+ IMessagesResource resource = messagesBundle.getResource();
+ final TextEditor textEditor = (TextEditor) resource.getSource();
+ // index + 1 because of i18n page
+ int pageIndex = textEditorsIndex.indexOf(textEditor) + 1;
+ removePage(pageIndex);
+
+ textEditorsIndex.remove(textEditor);
+ localesIndex.remove(messagesBundle.getLocale());
+
+ textEditor.dispose();
+
+ // remove entry from i18n page
+ i18nPage.removeI18NEntry(messagesBundle.getLocale());
+ }
+
+ /**
* Called when the editor's pages need to be reloaded. For example when the
* filters of locale is changed.
* <p>
@@ -256,7 +275,7 @@ public class MessagesEditor extends MultiPageEditorPart implements IGotoMarker,
// // maybe new init?
}
- private void refreshKeyTreeModel() {
+ protected void refreshKeyTreeModel() {
String selectedKey = getSelectedKey(); // memorize
if (messagesBundleGroup == null) {
@@ -384,8 +403,10 @@ public class MessagesEditor extends MultiPageEditorPart implements IGotoMarker,
FileEditorInput input = (FileEditorInput) editor
.getEditorInput();
try {
+ IFile file = input.getFile();
+ file.refreshLocal(IResource.DEPTH_ZERO, null);
BufferedReader reader = new BufferedReader(
- new InputStreamReader(input.getFile().getContents()));
+ new InputStreamReader(file.getContents()));
String line = "";
int selectionIndex = 0;
boolean found = false;
@@ -428,15 +449,15 @@ public class MessagesEditor extends MultiPageEditorPart implements IGotoMarker,
return false;
}
- private void closeIfAreadyOpen(IEditorSite site, IFile file) {
+ protected void closeIfAreadyOpen(IEditorSite site, IFile file) {
IWorkbenchPage[] pages = site.getWorkbenchWindow().getPages();
for (int i = 0; i < pages.length; i++) {
IWorkbenchPage page = pages[i];
IEditorReference[] editors = page.getEditorReferences();
for (int j = 0; j < editors.length; j++) {
IEditorPart editor = editors[j].getEditor(false);
- if (editor instanceof MessagesEditor) {
- MessagesEditor rbe = (MessagesEditor) editor;
+ if (editor instanceof AbstractMessagesEditor) {
+ AbstractMessagesEditor rbe = (AbstractMessagesEditor) editor;
if (rbe.isBundleMember(file)) {
page.closeEditor(editor, true);
}
@@ -457,6 +478,8 @@ public class MessagesEditor extends MultiPageEditorPart implements IGotoMarker,
for (ITextEditor textEditor : textEditorsIndex) {
textEditor.dispose();
}
+
+ disposeRAP();
}
/**
@@ -564,4 +587,28 @@ public class MessagesEditor extends MultiPageEditorPart implements IGotoMarker,
int index = localesIndex.indexOf(locale);
return textEditorsIndex.get(index);
}
+
+ // Needed for RAP, otherwise super implementation of getTitleImage always
+ // returns
+ // same image with same device and same session context, and when this
+ // session ends
+ // -> NPE at org.eclipse.swt.graphics.Image.getImageData(Image.java:348)
+ @Override
+ public Image getTitleImage() {
+ // create new image with current display
+ return UIUtils.getImageDescriptor(UIUtils.IMAGE_RESOURCE_BUNDLE)
+ .createImage();
+ }
+
+ public void setTitleName(String name) {
+ setPartName(name);
+ }
+
+ abstract public void setEnabled(boolean enabled);
+
+ abstract protected void initRAP();
+
+ abstract protected void disposeRAP();
+
+ abstract protected IMessagesBundleGroupListener getMsgBundleGroupListner();
}
diff --git a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/internal/MessagesEditorContributor.java b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/internal/MessagesEditorContributor.java
index c0c2135..cd47369 100644
--- a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/internal/MessagesEditorContributor.java
+++ b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/internal/MessagesEditorContributor.java
@@ -172,7 +172,7 @@ public class MessagesEditorContributor extends
*/
public void setActiveEditor(IEditorPart part) {
super.setActiveEditor(part);
- MessagesEditor me = part instanceof MessagesEditor ? (MessagesEditor) part
+ AbstractMessagesEditor me = part instanceof AbstractMessagesEditor ? (AbstractMessagesEditor) part
: null;
toggleKeyTreeAction.setEditor(me);
((FilterKeysActionGroup) FILTERS).setActiveEditor(part);
@@ -217,7 +217,7 @@ public class MessagesEditorContributor extends
}
public void setActiveEditor(IEditorPart part) {
- MessagesEditor me = part instanceof MessagesEditor ? (MessagesEditor) part
+ AbstractMessagesEditor me = part instanceof AbstractMessagesEditor ? (AbstractMessagesEditor) part
: null;
for (int i = 0; i < filtersAction.length; i++) {
filtersAction[i].setEditor(me);
diff --git a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/plugin/MessagesEditorPlugin.java b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/plugin/MessagesEditorPlugin.java
index 3619a1e..89b1c0e 100644
--- a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/plugin/MessagesEditorPlugin.java
+++ b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/plugin/MessagesEditorPlugin.java
@@ -182,15 +182,19 @@ public class MessagesEditorPlugin extends AbstractUIPlugin implements
};
ResourcesPlugin.getWorkspace().addResourceChangeListener(
resourceChangeListener);
-
+ try {
Display.getDefault().asyncExec(new Runnable() {
public void run() {
- Display.getDefault()
- .addFilter(SWT.KeyUp, new UndoKeyListener());
+ Display.getDefault().addFilter(SWT.KeyUp,
+ new UndoKeyListener());
}
});
+ } catch (NullPointerException e) {
+ // TODO [RAP] Non UI-Thread, no default display available, in RAP
+ // multiple clients and displays
+ }
}
/**
diff --git a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/preferences/MsgEditorPreferences.java b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/preferences/MsgEditorPreferences.java
index 5576eed..6c40a50 100644
--- a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/preferences/MsgEditorPreferences.java
+++ b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/preferences/MsgEditorPreferences.java
@@ -19,7 +19,7 @@ import org.eclipse.babel.core.message.resource.ser.IPropertiesSerializerConfig;
import org.eclipse.babel.editor.IMessagesEditorChangeListener;
import org.eclipse.babel.editor.builder.Builder;
import org.eclipse.babel.editor.builder.ToggleNatureAction;
-import org.eclipse.babel.editor.internal.MessagesEditor;
+import org.eclipse.babel.editor.internal.AbstractMessagesEditor;
import org.eclipse.babel.editor.plugin.MessagesEditorPlugin;
import org.eclipse.core.resources.ICommand;
import org.eclipse.core.resources.IProject;
@@ -527,9 +527,9 @@ public final class MsgEditorPreferences implements /*
for (int j = 0; j < edRefs.length; j++) {
IEditorReference ref = edRefs[j];
IEditorPart edPart = ref.getEditor(false);
- if (edPart != null && edPart instanceof MessagesEditor) {
+ if (edPart != null && edPart instanceof AbstractMessagesEditor) {
// the editor was loaded. reload it:
- MessagesEditor meToReload = (MessagesEditor) edPart;
+ AbstractMessagesEditor meToReload = (AbstractMessagesEditor) edPart;
meToReload.reloadDisplayedContents();
}
}
diff --git a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/tree/actions/AbstractRenameKeyAction.java b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/tree/actions/AbstractRenameKeyAction.java
new file mode 100644
index 0000000..f57faa1
--- /dev/null
+++ b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/tree/actions/AbstractRenameKeyAction.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Pascal Essiembre.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Pascal Essiembre - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.babel.editor.tree.actions;
+
+import org.eclipse.babel.editor.internal.AbstractMessagesEditor;
+import org.eclipse.babel.editor.plugin.MessagesEditorPlugin;
+import org.eclipse.babel.editor.util.UIUtils;
+import org.eclipse.jface.viewers.TreeViewer;
+
+/**
+ * @author Pascal Essiembre
+ *
+ */
+public abstract class AbstractRenameKeyAction extends AbstractTreeAction {
+
+ public static final String INSTANCE_CLASS = "org.eclipse.babel.editor.tree.actions.RenameKeyAction";
+
+ public AbstractRenameKeyAction(AbstractMessagesEditor editor,
+ TreeViewer treeViewer) {
+ super(editor, treeViewer);
+ setText(MessagesEditorPlugin.getString("key.rename") + " ..."); //$NON-NLS-1$
+ setImageDescriptor(UIUtils.getImageDescriptor(UIUtils.IMAGE_RENAME));
+ setToolTipText("TODO put something here"); // TODO put tooltip
+ }
+
+ /**
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ @Override
+ public abstract void run();
+}
diff --git a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/tree/actions/AbstractTreeAction.java b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/tree/actions/AbstractTreeAction.java
index 46e71a5..d537d78 100644
--- a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/tree/actions/AbstractTreeAction.java
+++ b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/tree/actions/AbstractTreeAction.java
@@ -13,7 +13,7 @@ package org.eclipse.babel.editor.tree.actions;
import org.eclipse.babel.core.message.internal.MessagesBundleGroup;
import org.eclipse.babel.core.message.tree.internal.AbstractKeyTreeModel;
import org.eclipse.babel.core.message.tree.internal.KeyTreeNode;
-import org.eclipse.babel.editor.internal.MessagesEditor;
+import org.eclipse.babel.editor.internal.AbstractMessagesEditor;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITreeContentProvider;
@@ -30,12 +30,13 @@ public abstract class AbstractTreeAction extends Action {
// KeyTreeNode[]{};
protected final TreeViewer treeViewer;
- protected final MessagesEditor editor;
+ protected final AbstractMessagesEditor editor;
/**
*
*/
- public AbstractTreeAction(MessagesEditor editor, TreeViewer treeViewer) {
+ public AbstractTreeAction(AbstractMessagesEditor editor,
+ TreeViewer treeViewer) {
super();
this.treeViewer = treeViewer;
this.editor = editor;
@@ -44,8 +45,8 @@ public abstract class AbstractTreeAction extends Action {
/**
*
*/
- public AbstractTreeAction(MessagesEditor editor, TreeViewer treeViewer,
- int style) {
+ public AbstractTreeAction(AbstractMessagesEditor editor,
+ TreeViewer treeViewer, int style) {
super("", style);
this.treeViewer = treeViewer;
this.editor = editor;
@@ -82,7 +83,7 @@ public abstract class AbstractTreeAction extends Action {
return treeViewer;
}
- protected MessagesEditor getEditor() {
+ protected AbstractMessagesEditor getEditor() {
return editor;
}
diff --git a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/tree/actions/AddKeyAction.java b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/tree/actions/AddKeyAction.java
index d55bf21..2d0273e 100644
--- a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/tree/actions/AddKeyAction.java
+++ b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/tree/actions/AddKeyAction.java
@@ -12,7 +12,7 @@ package org.eclipse.babel.editor.tree.actions;
import org.eclipse.babel.core.message.internal.MessagesBundleGroup;
import org.eclipse.babel.core.message.tree.internal.KeyTreeNode;
-import org.eclipse.babel.editor.internal.MessagesEditor;
+import org.eclipse.babel.editor.internal.AbstractMessagesEditor;
import org.eclipse.babel.editor.plugin.MessagesEditorPlugin;
import org.eclipse.babel.editor.util.UIUtils;
import org.eclipse.jface.dialogs.IInputValidator;
@@ -29,7 +29,7 @@ public class AddKeyAction extends AbstractTreeAction {
/**
*
*/
- public AddKeyAction(MessagesEditor editor, TreeViewer treeViewer) {
+ public AddKeyAction(AbstractMessagesEditor editor, TreeViewer treeViewer) {
super(editor, treeViewer);
setText(MessagesEditorPlugin.getString("key.add") + " ..."); //$NON-NLS-1$
setImageDescriptor(UIUtils.getImageDescriptor(UIUtils.IMAGE_ADD));
diff --git a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/tree/actions/CollapseAllAction.java b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/tree/actions/CollapseAllAction.java
index 7707356..a4f5018 100644
--- a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/tree/actions/CollapseAllAction.java
+++ b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/tree/actions/CollapseAllAction.java
@@ -10,7 +10,7 @@
******************************************************************************/
package org.eclipse.babel.editor.tree.actions;
-import org.eclipse.babel.editor.internal.MessagesEditor;
+import org.eclipse.babel.editor.internal.AbstractMessagesEditor;
import org.eclipse.babel.editor.plugin.MessagesEditorPlugin;
import org.eclipse.babel.editor.util.UIUtils;
import org.eclipse.jface.viewers.TreeViewer;
@@ -25,7 +25,8 @@ public class CollapseAllAction extends AbstractTreeAction {
* @param editor
* @param treeViewer
*/
- public CollapseAllAction(MessagesEditor editor, TreeViewer treeViewer) {
+ public CollapseAllAction(AbstractMessagesEditor editor,
+ TreeViewer treeViewer) {
super(editor, treeViewer);
setText(MessagesEditorPlugin.getString("key.collapseAll")); //$NON-NLS-1$
setImageDescriptor(UIUtils
diff --git a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/tree/actions/DeleteKeyAction.java b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/tree/actions/DeleteKeyAction.java
index d28cb5c..6135d93 100644
--- a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/tree/actions/DeleteKeyAction.java
+++ b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/tree/actions/DeleteKeyAction.java
@@ -12,7 +12,7 @@ package org.eclipse.babel.editor.tree.actions;
import org.eclipse.babel.core.message.internal.MessagesBundleGroup;
import org.eclipse.babel.core.message.tree.internal.KeyTreeNode;
-import org.eclipse.babel.editor.internal.MessagesEditor;
+import org.eclipse.babel.editor.internal.AbstractMessagesEditor;
import org.eclipse.babel.editor.plugin.MessagesEditorPlugin;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.SWT;
@@ -29,7 +29,7 @@ public class DeleteKeyAction extends AbstractTreeAction {
/**
*
*/
- public DeleteKeyAction(MessagesEditor editor, TreeViewer treeViewer) {
+ public DeleteKeyAction(AbstractMessagesEditor editor, TreeViewer treeViewer) {
super(editor, treeViewer);
setText(MessagesEditorPlugin.getString("key.delete")); //$NON-NLS-1$
setImageDescriptor(PlatformUI.getWorkbench().getSharedImages()
diff --git a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/tree/actions/ExpandAllAction.java b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/tree/actions/ExpandAllAction.java
index 1a87db8..61d1ad2 100644
--- a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/tree/actions/ExpandAllAction.java
+++ b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/tree/actions/ExpandAllAction.java
@@ -10,7 +10,7 @@
******************************************************************************/
package org.eclipse.babel.editor.tree.actions;
-import org.eclipse.babel.editor.internal.MessagesEditor;
+import org.eclipse.babel.editor.internal.AbstractMessagesEditor;
import org.eclipse.babel.editor.plugin.MessagesEditorPlugin;
import org.eclipse.babel.editor.util.UIUtils;
import org.eclipse.jface.viewers.TreeViewer;
@@ -25,7 +25,7 @@ public class ExpandAllAction extends AbstractTreeAction {
* @param editor
* @param treeViewer
*/
- public ExpandAllAction(MessagesEditor editor, TreeViewer treeViewer) {
+ public ExpandAllAction(AbstractMessagesEditor editor, TreeViewer treeViewer) {
super(editor, treeViewer);
setText(MessagesEditorPlugin.getString("key.expandAll")); //$NON-NLS-1$
setImageDescriptor(UIUtils.getImageDescriptor(UIUtils.IMAGE_EXPAND_ALL));
diff --git a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/tree/actions/FlatModelAction.java b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/tree/actions/FlatModelAction.java
index 09070a6..9d5b3d9 100644
--- a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/tree/actions/FlatModelAction.java
+++ b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/tree/actions/FlatModelAction.java
@@ -11,7 +11,7 @@
package org.eclipse.babel.editor.tree.actions;
import org.eclipse.babel.core.message.tree.TreeType;
-import org.eclipse.babel.editor.internal.MessagesEditor;
+import org.eclipse.babel.editor.internal.AbstractMessagesEditor;
import org.eclipse.babel.editor.plugin.MessagesEditorPlugin;
import org.eclipse.babel.editor.tree.internal.KeyTreeContentProvider;
import org.eclipse.babel.editor.util.UIUtils;
@@ -28,7 +28,7 @@ public class FlatModelAction extends AbstractTreeAction {
* @param editor
* @param treeViewer
*/
- public FlatModelAction(MessagesEditor editor, TreeViewer treeViewer) {
+ public FlatModelAction(AbstractMessagesEditor editor, TreeViewer treeViewer) {
super(editor, treeViewer, IAction.AS_RADIO_BUTTON);
setText(MessagesEditorPlugin.getString("key.layout.flat")); //$NON-NLS-1$
setImageDescriptor(UIUtils
diff --git a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/tree/actions/RefactorKeyAction.java b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/tree/actions/RefactorKeyAction.java
new file mode 100644
index 0000000..062ef06
--- /dev/null
+++ b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/tree/actions/RefactorKeyAction.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Alexej Strelzow.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Alexej Strelzow - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.babel.editor.tree.actions;
+
+import org.eclipse.babel.core.message.manager.RBManager;
+import org.eclipse.babel.core.message.tree.internal.KeyTreeNode;
+import org.eclipse.babel.editor.internal.AbstractMessagesEditor;
+import org.eclipse.babel.editor.plugin.MessagesEditorPlugin;
+import org.eclipse.babel.editor.util.UIUtils;
+import org.eclipse.jface.viewers.TreeViewer;
+
+/**
+ * An action, which triggers the refactoring of message keys.
+ *
+ * @author Alexej Strelzow
+ */
+public class RefactorKeyAction extends AbstractTreeAction {
+
+ /**
+ * Constructor.
+ *
+ * @param editor
+ * The {@link MessagesEditor}
+ * @param treeViewer
+ * The {@link TreeViewer}
+ */
+ public RefactorKeyAction(AbstractMessagesEditor editor,
+ TreeViewer treeViewer) {
+ super(editor, treeViewer);
+ setText(MessagesEditorPlugin.getString("key.refactor") + " ..."); //$NON-NLS-1$
+ setImageDescriptor(UIUtils
+ .getImageDescriptor(UIUtils.IMAGE_REFACTORING));
+ setToolTipText("Refactor the name of the key");
+ }
+
+ /**
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ @Override
+ public void run() {
+ KeyTreeNode node = getNodeSelection();
+
+ String key = node.getMessageKey();
+ String bundleId = node.getMessagesBundleGroup().getResourceBundleId();
+ String projectName = node.getMessagesBundleGroup().getProjectName();
+
+ RBManager.getRefactorService().openRefactorDialog(projectName,
+ bundleId, key, null);
+
+ }
+}
diff --git a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/tree/actions/TreeModelAction.java b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/tree/actions/TreeModelAction.java
index 756b2ae..4f5ed4d 100644
--- a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/tree/actions/TreeModelAction.java
+++ b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/tree/actions/TreeModelAction.java
@@ -11,7 +11,7 @@
package org.eclipse.babel.editor.tree.actions;
import org.eclipse.babel.core.message.tree.TreeType;
-import org.eclipse.babel.editor.internal.MessagesEditor;
+import org.eclipse.babel.editor.internal.AbstractMessagesEditor;
import org.eclipse.babel.editor.plugin.MessagesEditorPlugin;
import org.eclipse.babel.editor.tree.internal.KeyTreeContentProvider;
import org.eclipse.babel.editor.util.UIUtils;
@@ -28,7 +28,7 @@ public class TreeModelAction extends AbstractTreeAction {
* @param editor
* @param treeViewer
*/
- public TreeModelAction(MessagesEditor editor, TreeViewer treeViewer) {
+ public TreeModelAction(AbstractMessagesEditor editor, TreeViewer treeViewer) {
super(editor, treeViewer, IAction.AS_RADIO_BUTTON);
setText(MessagesEditorPlugin.getString("key.layout.tree")); //$NON-NLS-1$
setImageDescriptor(UIUtils
diff --git a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/tree/internal/KeyTreeContributor.java b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/tree/internal/KeyTreeContributor.java
index ace9d7b..162b47f 100644
--- a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/tree/internal/KeyTreeContributor.java
+++ b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/tree/internal/KeyTreeContributor.java
@@ -10,6 +10,7 @@
******************************************************************************/
package org.eclipse.babel.editor.tree.internal;
+import java.lang.reflect.Constructor;
import java.util.Observable;
import java.util.Observer;
@@ -19,19 +20,22 @@ import org.eclipse.babel.core.message.tree.internal.AbstractKeyTreeModel;
import org.eclipse.babel.core.message.tree.internal.IKeyTreeModelListener;
import org.eclipse.babel.core.message.tree.internal.KeyTreeNode;
import org.eclipse.babel.editor.IMessagesEditorChangeListener;
-import org.eclipse.babel.editor.internal.MessagesEditor;
+import org.eclipse.babel.editor.internal.AbstractMessagesEditor;
import org.eclipse.babel.editor.internal.MessagesEditorChangeAdapter;
import org.eclipse.babel.editor.internal.MessagesEditorMarkers;
import org.eclipse.babel.editor.tree.IKeyTreeContributor;
+import org.eclipse.babel.editor.tree.actions.AbstractRenameKeyAction;
import org.eclipse.babel.editor.tree.actions.AddKeyAction;
import org.eclipse.babel.editor.tree.actions.DeleteKeyAction;
-import org.eclipse.babel.editor.tree.actions.RenameKeyAction;
+import org.eclipse.babel.editor.tree.actions.RefactorKeyAction;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.ColumnViewerToolTipSupport;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TextCellEditor;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
@@ -52,14 +56,14 @@ import org.eclipse.swt.widgets.Tree;
*/
public class KeyTreeContributor implements IKeyTreeContributor {
- private MessagesEditor editor;
+ private AbstractMessagesEditor editor;
private AbstractKeyTreeModel treeModel;
private TreeType treeType;
/**
*
*/
- public KeyTreeContributor(final MessagesEditor editor) {
+ public KeyTreeContributor(final AbstractMessagesEditor editor) {
super();
this.editor = editor;
this.treeModel = new AbstractKeyTreeModel(editor.getBundleGroup());
@@ -101,6 +105,10 @@ public class KeyTreeContributor implements IKeyTreeContributor {
// Set input model
treeViewer.setInput(treeModel);
treeViewer.expandAll();
+
+ treeViewer.setColumnProperties(new String[] { "column1" });
+ treeViewer.setCellEditors(new CellEditor[] { new TextCellEditor(
+ treeViewer.getTree()) });
}
private class OnlyUnsuedAndMissingKey extends ViewerFilter implements
@@ -166,12 +174,16 @@ public class KeyTreeContributor implements IKeyTreeContributor {
private void contributeMarkers(final TreeViewer treeViewer) {
editor.getMarkers().addObserver(new Observer() {
public void update(Observable o, Object arg) {
- Display.getDefault().asyncExec(new Runnable() {
+ Display display = treeViewer.getTree().getDisplay();
+ // [RAP] only refresh tree viewer in this UIThread
+ if (display.equals(Display.getCurrent())) {
+ display.asyncExec(new Runnable() {
public void run() {
treeViewer.refresh();
}
});
}
+ }
});
// editor.addChangeListener(new MessagesEditorChangeAdapter() {
// public void editorDisposed() {
@@ -242,8 +254,10 @@ public class KeyTreeContributor implements IKeyTreeContributor {
public void nodeAdded(KeyTreeNode node) {
Display.getDefault().asyncExec(new Runnable() {
public void run() {
+ if (!editor.getI18NPage().isDisposed()) {
treeViewer.refresh(true);
}
+ }
});
};
@@ -253,8 +267,10 @@ public class KeyTreeContributor implements IKeyTreeContributor {
public void nodeRemoved(KeyTreeNode node) {
Display.getDefault().asyncExec(new Runnable() {
public void run() {
+ if (!editor.getI18NPage().isDisposed()) {
treeViewer.refresh(true);
}
+ }
});
};
};
@@ -340,9 +356,25 @@ public class KeyTreeContributor implements IKeyTreeContributor {
final IAction deleteAction = new DeleteKeyAction(editor, treeViewer);
menuManager.add(deleteAction);
// Rename
- final IAction renameAction = new RenameKeyAction(editor, treeViewer);
+ // final IAction renameAction = new RenameKeyAction(editor, treeViewer);
+ AbstractRenameKeyAction renameKeyAction = null;
+ try {
+ Class<?> clazz = Class
+ .forName(AbstractRenameKeyAction.INSTANCE_CLASS);
+ Constructor<?> cons = clazz.getConstructor(
+ AbstractMessagesEditor.class, TreeViewer.class);
+ renameKeyAction = (AbstractRenameKeyAction) cons.newInstance(
+ editor, treeViewer);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ final IAction renameAction = renameKeyAction;
menuManager.add(renameAction);
+ // Refactor
+ final IAction refactorAction = new RefactorKeyAction(editor, treeViewer);
+ menuManager.add(refactorAction);
+
menuManager.update(true);
tree.setMenu(menu);
diff --git a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/tree/internal/KeyTreeLabelProvider.java b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/tree/internal/KeyTreeLabelProvider.java
index 1a9b6ce..4ecef0b 100644
--- a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/tree/internal/KeyTreeLabelProvider.java
+++ b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/tree/internal/KeyTreeLabelProvider.java
@@ -17,7 +17,7 @@ import org.eclipse.babel.core.message.internal.MessagesBundleGroup;
import org.eclipse.babel.core.message.tree.IKeyTreeNode;
import org.eclipse.babel.core.message.tree.internal.AbstractKeyTreeModel;
import org.eclipse.babel.core.message.tree.internal.KeyTreeNode;
-import org.eclipse.babel.editor.internal.MessagesEditor;
+import org.eclipse.babel.editor.internal.AbstractMessagesEditor;
import org.eclipse.babel.editor.internal.MessagesEditorMarkers;
import org.eclipse.babel.editor.util.OverlayImageIcon;
import org.eclipse.babel.editor.util.UIUtils;
@@ -50,7 +50,7 @@ public class KeyTreeLabelProvider extends ColumnLabelProvider implements
/** Registry instead of UIUtils one for image not keyed by file name. */
private static ImageRegistry imageRegistry = new ImageRegistry();
- private MessagesEditor editor;
+ private AbstractMessagesEditor editor;
private MessagesBundleGroup messagesBundleGroup;
/**
@@ -67,7 +67,7 @@ public class KeyTreeLabelProvider extends ColumnLabelProvider implements
/**
*
*/
- public KeyTreeLabelProvider(MessagesEditor editor,
+ public KeyTreeLabelProvider(AbstractMessagesEditor editor,
AbstractKeyTreeModel treeModel,
KeyTreeContentProvider contentProvider) {
super();
diff --git a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/util/UIUtils.java b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/util/UIUtils.java
index 0e915e8..7153cad 100644
--- a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/util/UIUtils.java
+++ b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/util/UIUtils.java
@@ -16,6 +16,8 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.LineNumberReader;
import java.io.Reader;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
@@ -27,12 +29,15 @@ import java.util.List;
import java.util.Locale;
import java.util.Set;
+import org.eclipse.babel.editor.compat.SwtRapCompatibilitySWT;
import org.eclipse.babel.editor.plugin.MessagesEditorPlugin;
import org.eclipse.babel.editor.preferences.MsgEditorPreferences;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.resource.ImageDescriptor;
@@ -75,9 +80,9 @@ public final class UIUtils {
public static final String IMAGE_ADD = "add.png"; //$NON-NLS-1$
/** Name of edit icon. */
public static final String IMAGE_RENAME = "rename.gif"; //$NON-NLS-1$
+ /** Name of "view left" icon. */
/** Name of refactoring icon. */
public static final String IMAGE_REFACTORING = "refactoring.png"; //$NON-NLS-1$
- /** Name of "view left" icon. */
public static final String IMAGE_VIEW_LEFT = "viewLeft.gif"; //$NON-NLS-1$
/** Name of locale icon. */
public static final String IMAGE_LOCALE = "locale.gif"; //$NON-NLS-1$
@@ -101,13 +106,13 @@ public final class UIUtils {
public static final String IMAGE_ERROR = "error_co.gif"; //$NON-NLS-1$
/** Image registry. */
- private static final ImageRegistry imageRegistry =
+ private static ImageRegistry imageRegistry;
// TODO: REMOVE this comment eventually:
// necessary to specify the display otherwise Display.getCurrent()
// is called and will return null if this is not the UI-thread.
// this happens if the builder is called and initialize this class:
// the thread will not be the UI-thread.
- new ImageRegistry(PlatformUI.getWorkbench().getDisplay());
+ // new ImageRegistry(PlatformUI.getWorkbench().getDisplay());
public static final String PDE_NATURE = "org.eclipse.pde.PluginNature"; //$NON-NLS-1$
public static final String JDT_JAVA_NATURE = "org.eclipse.jdt.core.javanature"; //$NON-NLS-1$
@@ -126,7 +131,6 @@ public final class UIUtils {
public static final void sortLocales(Locale[] locales) {
List<Locale> localesList = new ArrayList<Locale>(Arrays.asList(locales));
Comparator<Locale> comp = new Comparator<Locale>() {
- @Override
public int compare(Locale l1, Locale l2) {
if (ROOT_LOCALE.equals(l1)) {
return -1;
@@ -443,6 +447,35 @@ public final class UIUtils {
* @return image
*/
public static Image getImage(String imageName) {
+ Image image = null;
+ try {
+ // [RAP] In RAP multiple displays could exist (multiple user),
+ // therefore image needs to be created every time with the current
+ // display
+ Method getImageRAP = Class.forName(
+ "org.eclipse.babel.editor.util.UIUtilsRAP").getMethod(
+ "getImage", String.class);
+ image = (Image) getImageRAP.invoke(null, imageName);
+ } catch (Exception e) {
+ // RAP fragment not running --> invoke rcp version
+ image = getImageRCP(imageName);
+ }
+
+ return image;
+ }
+
+ /**
+ * Gets an image from image registry or creates a new one if it the first
+ * time.
+ *
+ * @param imageName
+ * image name
+ * @return image
+ */
+ private static Image getImageRCP(String imageName) {
+ if (imageRegistry == null)
+ imageRegistry = new ImageRegistry(PlatformUI.getWorkbench()
+ .getDisplay());
Image image = imageRegistry.get(imageName);
if (image == null) {
image = getImageDescriptor(imageName).createImage();
@@ -535,7 +568,7 @@ public final class UIUtils {
ComponentOrientation orientation = ComponentOrientation
.getOrientation(locale);
if (orientation == ComponentOrientation.RIGHT_TO_LEFT) {
- return SWT.RIGHT_TO_LEFT;
+ return SwtRapCompatibilitySWT.RIGHT_TO_LEFT;
}
}
return SWT.LEFT_TO_RIGHT;
@@ -563,11 +596,11 @@ public final class UIUtils {
if (!projDescr.exists()) {
return false;// a corrupted project
}
-
// <classpathentry kind="src" path="src"/>
InputStream in = null;
try {
- in = ((IFile) projDescr).getContents();
+ projDescr.refreshLocal(IResource.DEPTH_ZERO, null);
+ in = projDescr.getContents();
// supposedly in utf-8. should not really matter for us
Reader r = new InputStreamReader(in, "UTF-8");
LineNumberReader lnr = new LineNumberReader(r);
diff --git a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/views/MessagesBundleGroupOutline.java b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/views/MessagesBundleGroupOutline.java
index f9a5dee..fc5242d 100644
--- a/org.eclipse.babel.editor/src/org/eclipse/babel/editor/views/MessagesBundleGroupOutline.java
+++ b/org.eclipse.babel.editor/src/org/eclipse/babel/editor/views/MessagesBundleGroupOutline.java
@@ -10,7 +10,7 @@
******************************************************************************/
package org.eclipse.babel.editor.views;
-import org.eclipse.babel.editor.internal.MessagesEditor;
+import org.eclipse.babel.editor.internal.AbstractMessagesEditor;
import org.eclipse.babel.editor.tree.actions.CollapseAllAction;
import org.eclipse.babel.editor.tree.actions.ExpandAllAction;
import org.eclipse.babel.editor.tree.actions.FlatModelAction;
@@ -28,9 +28,9 @@ import org.eclipse.ui.views.contentoutline.ContentOutlinePage;
*/
public class MessagesBundleGroupOutline extends ContentOutlinePage {
- private final MessagesEditor editor;
+ private final AbstractMessagesEditor editor;
- public MessagesBundleGroupOutline(MessagesEditor editor) {
+ public MessagesBundleGroupOutline(AbstractMessagesEditor editor) {
super();
this.editor = editor;
}
diff --git a/org.eclipse.babel.editor/src/org/eclipse/pde/nls/internal/ui/editor/LocalizationEditor.java b/org.eclipse.babel.editor/src/org/eclipse/pde/nls/internal/ui/editor/LocalizationEditor.java
index fa1a606..b1b4bef 100644
--- a/org.eclipse.babel.editor/src/org/eclipse/pde/nls/internal/ui/editor/LocalizationEditor.java
+++ b/org.eclipse.babel.editor/src/org/eclipse/pde/nls/internal/ui/editor/LocalizationEditor.java
@@ -22,6 +22,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Locale;
+import org.eclipse.babel.editor.compat.SwtRapCompatibilityFormToolkit;
import org.eclipse.babel.editor.plugin.MessagesEditorPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -415,7 +416,7 @@ public class LocalizationEditor extends EditorPart {
private ExportAction exportAction;
// Form
- protected FormToolkit toolkit = new FormToolkit(Display.getCurrent());
+ protected SwtRapCompatibilityFormToolkit toolkit = new SwtRapCompatibilityFormToolkit(Display.getCurrent());
private Form form;
private Image formImage;