Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorptessier2014-12-12 10:16:36 +0000
committerptessier2014-12-12 10:16:36 +0000
commit420724fe8864eb72be1e4f8359c9b1194c472d4a (patch)
treeec7023b666e0822b08a21b2551850775c93d1e25 /extraplugins/epf-richtext
parenteb843ee2fc72de0e1576f8f2d1a2939fed429dfd (diff)
downloadorg.eclipse.papyrus-420724fe8864eb72be1e4f8359c9b1194c472d4a.tar.gz
org.eclipse.papyrus-420724fe8864eb72be1e4f8359c9b1194c472d4a.tar.xz
org.eclipse.papyrus-420724fe8864eb72be1e4f8359c9b1194c472d4a.zip
399853: [Widgets] Papyrus shall enable to edit the comment body with a
rich-text editor https://bugs.eclipse.org/bugs/show_bug.cgi?id=399853 # WARNING: head commit changed in the meantime Merge branch 'master' of ssh://ptessier@git.eclipse.org:29418/papyrus/org.eclipse.papyrus Change-Id: I6cf32e8e84e57057d40c1a2a9ffd6cbcdd01224e
Diffstat (limited to 'extraplugins/epf-richtext')
-rw-r--r--extraplugins/epf-richtext/org.eclipse.papyrus.infra.widgets.epf.richtext.extension/src/org/eclipse/papyrus/infra/widgets/epf/richtext/JDebugConsol.java89
-rw-r--r--extraplugins/epf-richtext/org.eclipse.papyrus.infra.widgets.epf.richtext.extension/src/org/eclipse/papyrus/infra/widgets/epf/richtext/extension/RichText.java5
-rw-r--r--extraplugins/epf-richtext/org.eclipse.papyrus.infra.widgets.epf.richtext.extension/src/org/eclipse/papyrus/infra/widgets/epf/richtext/extension/RichTextEditor.java24
3 files changed, 118 insertions, 0 deletions
diff --git a/extraplugins/epf-richtext/org.eclipse.papyrus.infra.widgets.epf.richtext.extension/src/org/eclipse/papyrus/infra/widgets/epf/richtext/JDebugConsol.java b/extraplugins/epf-richtext/org.eclipse.papyrus.infra.widgets.epf.richtext.extension/src/org/eclipse/papyrus/infra/widgets/epf/richtext/JDebugConsol.java
new file mode 100644
index 00000000000..013da488777
--- /dev/null
+++ b/extraplugins/epf-richtext/org.eclipse.papyrus.infra.widgets.epf.richtext.extension/src/org/eclipse/papyrus/infra/widgets/epf/richtext/JDebugConsol.java
@@ -0,0 +1,89 @@
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ *
+ * 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:
+ * Patrick Tessier (CEA LIST) patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.widgets.epf.richtext;
+
+import javax.swing.JFrame;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+
+
+/**
+ * This class turns 'e' characters red using a LineStyleListener
+ */
+public class JDebugConsol {
+ // Color for the StyleRanges
+
+ private JTextArea label;
+
+ /**
+ * Runs the application
+ */
+ public void run() {
+ JFrame frame = new JFrame("Sequoia Console");
+ frame.setSize(300, 200);
+
+
+ // Get color for style ranges
+ createContents(frame);
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ // frame.pack();
+ frame.setVisible(true);
+ //while (!shell.isDisposed()) {
+ // if (!display.readAndDispatch()) {
+ // display.sleep();
+ // }
+ //}
+ //display.dispose();
+ }
+
+ /**
+ * Creates the main window contents
+ *
+ * @param shell the main window
+ */
+ private void createContents(JFrame frame) {
+ label = new JTextArea();
+ JScrollPane scrollPane = new JScrollPane(label);
+
+
+ frame.getContentPane().add(scrollPane);
+
+
+
+
+
+ }
+ public void write(String print){
+ if(label!=null){
+ label.setText(label.getText()+"\n"+print);
+ }
+
+ }
+
+ /**
+ * The application entry point
+ *
+ * @param args the command line arguments
+ */
+ public static void main(String[] args) {
+ JDebugConsol consol= new JDebugConsol();
+ consol.run();
+ consol.write("text");
+ consol.write("uu\ntext");
+ JDebugConsol consol1= new JDebugConsol();
+ consol1.run();
+ consol1.write("text");
+ consol1.write("uu\ntextuu\ntextuu\ntextuu\ntextuu\ntextuu\ntextuu\ntextuu\ntextuu\ntextuu\ntextuu\ntextuu\ntext");
+ }
+}
diff --git a/extraplugins/epf-richtext/org.eclipse.papyrus.infra.widgets.epf.richtext.extension/src/org/eclipse/papyrus/infra/widgets/epf/richtext/extension/RichText.java b/extraplugins/epf-richtext/org.eclipse.papyrus.infra.widgets.epf.richtext.extension/src/org/eclipse/papyrus/infra/widgets/epf/richtext/extension/RichText.java
index 84d1920b7a3..5e7aed009e8 100644
--- a/extraplugins/epf-richtext/org.eclipse.papyrus.infra.widgets.epf.richtext.extension/src/org/eclipse/papyrus/infra/widgets/epf/richtext/extension/RichText.java
+++ b/extraplugins/epf-richtext/org.eclipse.papyrus.infra.widgets.epf.richtext.extension/src/org/eclipse/papyrus/infra/widgets/epf/richtext/extension/RichText.java
@@ -20,6 +20,7 @@ import org.eclipse.epf.common.xml.XSLTProcessor;
import org.eclipse.epf.richtext.actions.CopyAction;
import org.eclipse.epf.richtext.actions.CutAction;
import org.eclipse.epf.richtext.actions.PastePlainTextAction;
+import org.eclipse.papyrus.infra.widgets.epf.richtext.JDebugConsol;
import org.eclipse.papyrus.infra.widgets.epf.richtext.extension.actions.PasteAction;
import org.eclipse.papyrus.infra.widgets.epf.richtext.extension.actions.PasteTextOnlyAction;
import org.eclipse.swt.SWT;
@@ -158,6 +159,10 @@ public class RichText extends org.eclipse.epf.richtext.RichText {
rteXML.append("<rte id=\"").append("rte").append("\" css=\"").append(escapedRteUTL + "rte.css").append("\" js=\"").append(escapedRteUTL + "rte.js").append("\" baseURL=\"").append(escapedBasePath).append("\"/>");
StringWriter result = new StringWriter();
XSLTProcessor.transform(this.rteFolder + "rte.xsl", rteXML.toString(), result);
+ JDebugConsol debugConsol= new JDebugConsol();
+ debugConsol.run();
+ debugConsol.write("RichText.generateEditorHTML"+ editable);
+ debugConsol.write("result.toString()"+result.toString());
return result.toString();
}
diff --git a/extraplugins/epf-richtext/org.eclipse.papyrus.infra.widgets.epf.richtext.extension/src/org/eclipse/papyrus/infra/widgets/epf/richtext/extension/RichTextEditor.java b/extraplugins/epf-richtext/org.eclipse.papyrus.infra.widgets.epf.richtext.extension/src/org/eclipse/papyrus/infra/widgets/epf/richtext/extension/RichTextEditor.java
index 1ff28a18917..f915eafd1c4 100644
--- a/extraplugins/epf-richtext/org.eclipse.papyrus.infra.widgets.epf.richtext.extension/src/org/eclipse/papyrus/infra/widgets/epf/richtext/extension/RichTextEditor.java
+++ b/extraplugins/epf-richtext/org.eclipse.papyrus.infra.widgets.epf.richtext.extension/src/org/eclipse/papyrus/infra/widgets/epf/richtext/extension/RichTextEditor.java
@@ -68,6 +68,7 @@ import org.eclipse.jface.text.source.AnnotationModel;
import org.eclipse.jface.text.source.IAnnotationAccess;
import org.eclipse.jface.text.source.SourceViewer;
import org.eclipse.jface.text.source.SourceViewerConfiguration;
+import org.eclipse.papyrus.infra.widgets.epf.richtext.JDebugConsol;
import org.eclipse.papyrus.infra.widgets.epf.richtext.extension.actions.BackgroundColorAction;
import org.eclipse.papyrus.infra.widgets.epf.richtext.extension.actions.FontNameAction;
import org.eclipse.papyrus.infra.widgets.epf.richtext.extension.actions.FontSizeAction;
@@ -470,6 +471,16 @@ public class RichTextEditor extends Composite {
* the editable state
*/
public void setEditable(boolean editable) {
+ JDebugConsol debugConsol= new JDebugConsol();
+ debugConsol.run();
+ debugConsol.write("RichTextEditor.setEditable(boolean editable)"+ editable);
+ debugConsol.write("toolBar"+toolBar);
+ debugConsol.write("tabFolder"+tabFolder);
+ debugConsol.write("richText"+richText);
+ debugConsol.write("sourceViewer"+sourceViewer);
+ debugConsol.write("isHTMLTabSelected "+isHTMLTabSelected());
+
+
this.editable = editable;
if(toolBar != null && tabFolder != null) {
toolBar.updateToolBar(editable && !isHTMLTabSelected());
@@ -1107,6 +1118,19 @@ public class RichTextEditor extends Composite {
* Inserts text at the selection (overwriting the selection).
*/
public void addHTML(String text) {
+ JDebugConsol debugConsol= new JDebugConsol();
+ debugConsol.run();
+ debugConsol.write("--------info--------------");
+ debugConsol.write("richText"+richText);
+ debugConsol.write("richText.getEditable()"+richText.getEditable());
+ debugConsol.write("--------------------------");
+ debugConsol.write("try to add "+ text);
+ debugConsol.write("tabFolder "+tabFolder);
+ debugConsol.write("tabFolder.getSelection() "+tabFolder.getSelection());
+ debugConsol.write("richTextTab "+richTextTab);
+ debugConsol.write("tabFolder.getSelection() == richTextTab "+ (tabFolder.getSelection() == richTextTab));
+ debugConsol.write("htmlTab "+htmlTab);
+ debugConsol.write("tabFolder.getSelection() == htmlTab "+(tabFolder.getSelection() == htmlTab));
if(text == null || text.length() == 0)
return;
if(tabFolder.getSelection() == richTextTab) {

Back to the top