Author: vrubezhny
Date: 2007-10-22 13:58:09 -0400 (Mon, 22 Oct 2007)
New Revision: 4420
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editor/XMLContentDescriber.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/XMLTextEditorComponent.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/xmleditor/XMLTextEditor.java
Log:
http://jira.jboss.org/jira/browse/JBIDE-1124 hibernate tools code completion are no longer
available in hbm.xml editing
Issue is fixed.
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editor/XMLContentDescriber.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editor/XMLContentDescriber.java 2007-10-22
17:57:57 UTC (rev 4419)
+++
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editor/XMLContentDescriber.java 2007-10-22
17:58:09 UTC (rev 4420)
@@ -41,7 +41,8 @@
private int describe(String text, IContentDescription description) {
String entity =
PreferenceModelUtilities.getPreferenceModel().getEntityRecognizer().getEntityName("xml",
text);
- if(entity == null || entity.length() == 0 || entity.equals("FileXML")) {
+ if(entity == null || entity.length() == 0 || entity.equals("FileXML") ||
+ entity.equals("FileHibConfig3") ||
entity.equals("FileHibernate3")) {
return INDETERMINATE;
}
return VALID;
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/XMLTextEditorComponent.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/XMLTextEditorComponent.java 2007-10-22
17:57:57 UTC (rev 4419)
+++
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/XMLTextEditorComponent.java 2007-10-22
17:58:09 UTC (rev 4420)
@@ -27,6 +27,7 @@
import org.eclipse.jface.text.ITextSelection;
import org.eclipse.jface.text.TextEvent;
import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.jface.text.source.SourceViewerConfiguration;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.swt.events.FocusListener;
//import org.eclipse.swt.graphics.Point;
@@ -45,6 +46,8 @@
import org.eclipse.ui.texteditor.RevertToSavedAction;
import org.eclipse.ui.texteditor.SaveAction;
import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
+import org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration;
+import org.eclipse.wst.xml.ui.StructuredTextViewerConfigurationXML;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.filesystems.impl.DiscardFileHandler;
@@ -67,6 +70,12 @@
ModelPlugin.getWorkspace().addResourceChangeListener(changeListener = new ICL());
}
+ public XMLTextEditorComponent(SourceViewerConfiguration configuration) {
+ super(configuration);
+ support.setProvider(this);
+ ModelPlugin.getWorkspace().addResourceChangeListener(changeListener = new ICL());
+ }
+
protected TextEditorSupport createSupport() {
return new TextEditorSupport();
}
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 2007-10-22
17:57:57 UTC (rev 4419)
+++
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/xmleditor/XMLTextEditor.java 2007-10-22
17:58:09 UTC (rev 4420)
@@ -97,8 +97,27 @@
super.setSourceViewerConfiguration(new RedHatStructuredTextViewerConfigurationXML());
}
+ public XMLTextEditor(SourceViewerConfiguration config) {
+ super.setSourceViewerConfiguration(config);
+ XmlEditorPlugin.getDefault().initDefaultPluginPreferences();
+/// dnd.setTextEditorDropProvider(new TextEditorDropProviderImpl());
+ if (config != null) {
+ if (!(config instanceof RedHatStructuredTextViewerConfigurationXML)) {
+ rhsvcEnabled = false;
+ }
+ super.setSourceViewerConfiguration(config);
+ }
+ }
+
+ private boolean rhsvcEnabled = true;
+
+ protected boolean isRedHatSourceViewerConfigurationEnabled() {
+ return rhsvcEnabled;
+ }
+
protected void setSourceViewerConfiguration(SourceViewerConfiguration config) {
- if(!(config instanceof RedHatStructuredTextViewerConfigurationXML)
+ if( isRedHatSourceViewerConfigurationEnabled()
+ && !(config instanceof RedHatStructuredTextViewerConfigurationXML)
&& (config instanceof StructuredTextViewerConfigurationXML
|| !(config instanceof StructuredTextViewerConfiguration)
)