Author: scabanovich
Date: 2009-09-21 07:40:55 -0400 (Mon, 21 Sep 2009)
New Revision: 17673
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/PlainTextDropCommand.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/UnknownDropCommand.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/propertyeditor/PropertiesTextEditorStub.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/xmleditor/XMLTextEditor.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/palette/PaletteInsertHelper.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/palette/PaletteViewPart.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4913
Splitting PaletteInsertHelper into jsp and non-jsp related parts.
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/PlainTextDropCommand.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/PlainTextDropCommand.java 2009-09-21
08:10:16 UTC (rev 17672)
+++
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/PlainTextDropCommand.java 2009-09-21
11:40:55 UTC (rev 17673)
@@ -27,7 +27,7 @@
if(data == null) return;
Properties properties = new Properties();
properties.put(PaletteInsertHelper.PROPOPERTY_START_TEXT, data);
- PaletteInsertHelper.insertIntoEditor(
+ PaletteInsertHelper.getInstance().insertIntoEditor(
getDefaultModel().getDropData().getSourceViewer(),
properties
);
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/UnknownDropCommand.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/UnknownDropCommand.java 2009-09-21
08:10:16 UTC (rev 17672)
+++
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/UnknownDropCommand.java 2009-09-21
11:40:55 UTC (rev 17673)
@@ -28,7 +28,7 @@
fElementGenerator.setDataModel(getDefaultModel());
Properties properties = new Properties();
properties.put(PaletteInsertHelper.PROPOPERTY_START_TEXT,fElementGenerator.generateStartTag());
- PaletteInsertHelper.insertIntoEditor(
+ PaletteInsertHelper.getInstance().insertIntoEditor(
getDefaultModel().getDropData().getSourceViewer(),
properties
);
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/propertyeditor/PropertiesTextEditorStub.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/propertyeditor/PropertiesTextEditorStub.java 2009-09-21
08:10:16 UTC (rev 17672)
+++
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/propertyeditor/PropertiesTextEditorStub.java 2009-09-21
11:40:55 UTC (rev 17673)
@@ -59,7 +59,7 @@
}
public void insert(Properties p) {
- PaletteInsertHelper.insertIntoEditor(getSourceViewer(), p);
+ PaletteInsertHelper.getInstance().insertIntoEditor(getSourceViewer(), p);
}
}
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/xmleditor/XMLTextEditor.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/xmleditor/XMLTextEditor.java 2009-09-21
08:10:16 UTC (rev 17672)
+++
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/xmleditor/XMLTextEditor.java 2009-09-21
11:40:55 UTC (rev 17673)
@@ -385,7 +385,7 @@
}
public void insert(Properties p) {
- PaletteInsertHelper.insertIntoEditor(getSourceViewer(), p);
+ PaletteInsertHelper.getInstance().insertIntoEditor(getSourceViewer(), p);
}
public String getContext(int pos) {
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/palette/PaletteInsertHelper.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/palette/PaletteInsertHelper.java 2009-09-21
08:10:16 UTC (rev 17672)
+++
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/palette/PaletteInsertHelper.java 2009-09-21
11:40:55 UTC (rev 17673)
@@ -58,7 +58,15 @@
static PaletteTaglibInserter PaletteTaglibInserter = new PaletteTaglibInserter();
- public static void insertIntoEditor(ITextEditor editor, Properties p) {
+ static PaletteInsertHelper instance = new PaletteInsertHelper();
+
+ public static PaletteInsertHelper getInstance() {
+ return instance;
+ }
+
+ public PaletteInsertHelper() {}
+
+ public void insertIntoEditor(ITextEditor editor, Properties p) {
if(editor == null) return;
if(!isEditable(editor)) {
ServiceDialog d = PreferenceModelUtilities.getPreferenceModel().getService();
@@ -92,7 +100,7 @@
return true;
}
- public static void insertIntoEditor(final ISourceViewer v, Properties p) {
+ public void insertIntoEditor(final ISourceViewer v, Properties p) {
String tagname = p.getProperty(PROPOPERTY_TAG_NAME);
String startText = p.getProperty(PROPOPERTY_START_TEXT);
String endText = p.getProperty(PROPOPERTY_END_TEXT);
@@ -147,7 +155,7 @@
}
}
- private static void insertIntoEditorInternal(IDocument doc, Properties p) {
+ protected void insertIntoEditorInternal(IDocument doc, Properties p) {
String startText = p.getProperty(PROPOPERTY_START_TEXT);
String endText = p.getProperty(PROPOPERTY_END_TEXT);
String newline = p.getProperty(PROPOPERTY_NEW_LINE);
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/palette/PaletteViewPart.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/palette/PaletteViewPart.java 2009-09-21
08:10:16 UTC (rev 17672)
+++
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/palette/PaletteViewPart.java 2009-09-21
11:40:55 UTC (rev 17673)
@@ -166,7 +166,9 @@
properties.setProperty(PaletteInsertHelper.PROPOPERTY_REFORMAT_BODY, reformat);
properties.setProperty(PaletteInsertHelper.PROPOPERTY_NEW_LINE, newline);
properties.setProperty(PaletteInsertHelper.PROPOPERTY_ADD_TAGLIB, addTaglib);
- PaletteInsertHelper.insertIntoEditor(
+
+ //TODO WARNING we cannot have here correct insert helper instance!
+ PaletteInsertHelper.getInstance().insertIntoEditor(
editor,
properties
);