JBoss Tools SVN: r7280 - trunk/labs/plugins/org.jboss.tools.labs.pde.sourceprovider.
by jbosstools-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2008-04-03 06:46:54 -0400 (Thu, 03 Apr 2008)
New Revision: 7280
Modified:
trunk/labs/plugins/org.jboss.tools.labs.pde.sourceprovider/
Log:
svn ignore for bin
Property changes on: trunk/labs/plugins/org.jboss.tools.labs.pde.sourceprovider
___________________________________________________________________
Name: svn:ignore
+ bin
16 years, 11 months
JBoss Tools SVN: r7279 - in trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf: templates and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: sdzmitrovich
Date: 2008-04-03 06:30:53 -0400 (Thu, 03 Apr 2008)
New Revision: 7279
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfVerbatim.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/templates/vpe-templates-jsf.xml
Log:
http://jira.jboss.com/jira/browse/JBIDE-1488
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfVerbatim.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfVerbatim.java 2008-04-03 10:29:19 UTC (rev 7278)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfVerbatim.java 2008-04-03 10:30:53 UTC (rev 7279)
@@ -28,12 +28,6 @@
*/
public class JsfVerbatim extends EditableTemplateAdapter {
- /**
- * Instantiates a new jsf view.
- */
- public JsfVerbatim() {
- }
-
/*
* (non-Javadoc)
*
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/templates/vpe-templates-jsf.xml
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/templates/vpe-templates-jsf.xml 2008-04-03 10:29:19 UTC (rev 7278)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/templates/vpe-templates-jsf.xml 2008-04-03 10:30:53 UTC (rev 7279)
@@ -11,7 +11,7 @@
</vpe:tag>
<vpe:tag name="f:verbatim" case-sensitive="yes">
- <vpe:if test="(@escape='false')">
+ <vpe:if test="(@escape='false')">
<vpe:template children="no" modify="yes"
class="org.jboss.tools.jsf.vpe.jsf.template.JsfVerbatim">
<vpe:dnd>
16 years, 11 months
JBoss Tools SVN: r7278 - in trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf: templates and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: sdzmitrovich
Date: 2008-04-03 06:29:19 -0400 (Thu, 03 Apr 2008)
New Revision: 7278
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfVerbatim.java
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/templates/vpe-templates-jsf.xml
Log:
http://jira.jboss.com/jira/browse/JBIDE-1373
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfVerbatim.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfVerbatim.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfVerbatim.java 2008-04-03 10:29:19 UTC (rev 7278)
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jsf.vpe.jsf.template;
+
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
+import org.jboss.tools.vpe.editor.context.VpePageContext;
+import org.jboss.tools.vpe.editor.template.EditableTemplateAdapter;
+import org.jboss.tools.vpe.editor.template.VpeCreationData;
+import org.jboss.tools.vpe.editor.util.HTML;
+import org.jboss.tools.vpe.editor.util.TemplateManagingUtil;
+import org.mozilla.interfaces.nsIDOMDocument;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * @author Sergey Dzmitrovich
+ *
+ */
+public class JsfVerbatim extends EditableTemplateAdapter {
+
+ /**
+ * Instantiates a new jsf view.
+ */
+ public JsfVerbatim() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.tools.vpe.editor.template.VpeTemplate#create(org.jboss.tools.vpe.editor.context.VpePageContext,
+ * org.w3c.dom.Node, org.mozilla.interfaces.nsIDOMDocument)
+ */
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
+ nsIDOMDocument visualDocument) {
+
+ Element element = (Element) sourceNode;
+
+ nsIDOMElement span = visualDocument.createElement(HTML.TAG_SPAN);
+
+ NodeList list = element.getChildNodes();
+
+ if (list.getLength() != 0) {
+ Node firstNode = list.item(0);
+ Node lastNode = list.item(list.getLength() - 1);
+
+ String text = TemplateManagingUtil.getSourceText(pageContext,
+ ((IDOMNode) firstNode).getStartOffset(),
+ ((IDOMNode) lastNode).getEndOffset() - 1);
+
+ span.appendChild(visualDocument.createTextNode(text));
+
+ }
+
+ VpeCreationData creationData = new VpeCreationData(span);
+
+ return creationData;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.tools.vpe.editor.template.VpeAbstractTemplate#isRecreateAtAttrChange(org.jboss.tools.vpe.editor.context.VpePageContext,
+ * org.w3c.dom.Element, org.mozilla.interfaces.nsIDOMDocument,
+ * org.mozilla.interfaces.nsIDOMElement, java.lang.Object,
+ * java.lang.String, java.lang.String)
+ */
+ public boolean isRecreateAtAttrChange(VpePageContext pageContext,
+ Element sourceElement, nsIDOMDocument visualDocument,
+ nsIDOMElement visualNode, Object data, String name, String value) {
+ return true;
+ }
+
+}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/templates/vpe-templates-jsf.xml
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/templates/vpe-templates-jsf.xml 2008-04-03 10:15:29 UTC (rev 7277)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/templates/vpe-templates-jsf.xml 2008-04-03 10:29:19 UTC (rev 7278)
@@ -11,6 +11,15 @@
</vpe:tag>
<vpe:tag name="f:verbatim" case-sensitive="yes">
+ <vpe:if test="(@escape='false')">
+ <vpe:template children="no" modify="yes"
+ class="org.jboss.tools.jsf.vpe.jsf.template.JsfVerbatim">
+ <vpe:dnd>
+ <vpe:drag start-enable="yes" />
+ <vpe:drop container="yes" />
+ </vpe:dnd>
+ </vpe:template>
+ </vpe:if>
<vpe:template children="yes" modify="yes">
<span title="{tagstring()}" />
<vpe:dnd>
16 years, 11 months
JBoss Tools SVN: r7277 - in trunk: vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/dnd and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dsakovich
Date: 2008-04-03 06:15:29 -0400 (Thu, 03 Apr 2008)
New Revision: 7277
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/dnd/VpeDnD.java
Log:
http://jira.jboss.org/jira/browse/JBIDE-1836
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java 2008-04-03 09:42:06 UTC (rev 7276)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java 2008-04-03 10:15:29 UTC (rev 7277)
@@ -7,7 +7,7 @@
*
* Contributors:
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
+ ******************************************************************************/
package org.jboss.tools.jst.jsp.jspeditor;
import java.lang.reflect.Method;
@@ -135,1106 +135,1133 @@
/**
* @author Jeremy
- *
+ *
*/
public class JSPTextEditor extends StructuredTextEditor implements
- ITextListener, IJSPTextEditor, ITextFormatter,
- IOccurrencePreferenceProvider {
- private IStructuredTextOccurrenceStructureProvider fOccurrenceModelUpdater;
+ ITextListener, IJSPTextEditor, ITextFormatter,
+ IOccurrencePreferenceProvider {
+ private IStructuredTextOccurrenceStructureProvider fOccurrenceModelUpdater;
- TextEditorDrop dnd = new TextEditorDrop();
+ TextEditorDrop dnd = new TextEditorDrop();
- JSPMultiPageEditor parentEditor;
+ JSPMultiPageEditor parentEditor;
- long timeStamp = -1;
+ long timeStamp = -1;
- long savedTimeStamp = -1;
+ long savedTimeStamp = -1;
- IVisualController vpeController;
- //Added By Max Areshkau
- //Fix for JBIDE-788
- protected SourceEditorPageContext pageContext = null;
+ IVisualController vpeController;
+ // Added By Max Areshkau
+ // Fix for JBIDE-788
+ protected SourceEditorPageContext pageContext = null;
- private TextEditorDropProviderImpl textEditorDropProvider;
-
- private static final String SHOW_IN_MENU = "JSPMultiPageEditor.ContextMenu.ShowInMenu"; //$NON-NLS-1$
+ private TextEditorDropProviderImpl textEditorDropProvider;
- public JSPTextEditor(JSPMultiPageEditor parentEditor) {
- JspEditorPlugin.getDefault().initDefaultPluginPreferences();
- textEditorDropProvider = new TextEditorDropProviderImpl();
- dnd.setTextEditorDropProvider(textEditorDropProvider);
- this.parentEditor = parentEditor;
- super
- .setSourceViewerConfiguration(new JSPTextViewerConfiguration());
+ private static final String SHOW_IN_MENU = "JSPMultiPageEditor.ContextMenu.ShowInMenu"; //$NON-NLS-1$
+
+ public JSPTextEditor(JSPMultiPageEditor parentEditor) {
+ JspEditorPlugin.getDefault().initDefaultPluginPreferences();
+ textEditorDropProvider = new TextEditorDropProviderImpl();
+ dnd.setTextEditorDropProvider(textEditorDropProvider);
+ this.parentEditor = parentEditor;
+ super.setSourceViewerConfiguration(new JSPTextViewerConfiguration());
+ }
+
+ protected void setSourceViewerConfiguration(SourceViewerConfiguration config) {
+ if (config instanceof StructuredTextViewerConfigurationJSP) {
+ if (!(config instanceof JSPTextViewerConfiguration)) {
+ config = new JSPTextViewerConfiguration();
+ }
+ } else if (config instanceof StructuredTextViewerConfigurationHTML) {
+ if (!(config instanceof HTMLTextViewerConfiguration)) {
+ config = new HTMLTextViewerConfiguration();
+ }
+ } else {
+ config = new JSPTextViewerConfiguration();
}
-
- protected void setSourceViewerConfiguration(SourceViewerConfiguration config) {
- if (config instanceof StructuredTextViewerConfigurationJSP) {
- if (!(config instanceof JSPTextViewerConfiguration)) {
- config = new JSPTextViewerConfiguration();
- }
- } else if (config instanceof StructuredTextViewerConfigurationHTML) {
- if (!(config instanceof HTMLTextViewerConfiguration)) {
- config = new HTMLTextViewerConfiguration();
- }
- } else {
- config = new JSPTextViewerConfiguration();
- }
- super.setSourceViewerConfiguration(config);
- }
+ super.setSourceViewerConfiguration(config);
+ }
- /** This is *only* for allowing unit tests to access the source configuration. */
- public SourceViewerConfiguration getSourceViewerConfigurationForTest () {
- return getSourceViewerConfiguration();
- }
- //Added By Max Areshkau
- //Fix for JBIDE-788
+ /**
+ * This is *only* for allowing unit tests to access the source
+ * configuration.
+ */
+ public SourceViewerConfiguration getSourceViewerConfigurationForTest() {
+ return getSourceViewerConfiguration();
+ }
+
+ // Added By Max Areshkau
+ // Fix for JBIDE-788
public IVisualContext getPageContext() {
-
- if (pageContext==null) {
- pageContext = new SourceEditorPageContext();
- }
- IDocument document = getTextViewer().getDocument();
- int offset = this.getTextViewer().getTextWidget().getCaretOffset();
- IndexedRegion treeNode = ContentAssistUtils.getNodeAt(this.getTextViewer(), offset);
- Node node = (Node) treeNode;
- pageContext.setReferenceNode(node);
- pageContext.setDocument(document);
-
- return pageContext;
- }
-
- protected void initializeDrop(ITextViewer textViewer) {
- Composite c = textViewer.getTextWidget();
- Label l = new Label(c, SWT.NONE);
- l.dispose();
+ if (pageContext == null) {
+ pageContext = new SourceEditorPageContext();
}
+ IDocument document = getTextViewer().getDocument();
+ int offset = this.getTextViewer().getTextWidget().getCaretOffset();
+ IndexedRegion treeNode = ContentAssistUtils.getNodeAt(this
+ .getTextViewer(), offset);
+ Node node = (Node) treeNode;
+ pageContext.setReferenceNode(node);
+ pageContext.setDocument(document);
- private ConfigurableContentOutlinePage fOutlinePage = null;
+ return pageContext;
+ }
- private OutlinePageListener fOutlinePageListener = null;
+ protected void initializeDrop(ITextViewer textViewer) {
- private IPropertySheetPage fPropertySheetPage;
+ Composite c = textViewer.getTextWidget();
+ Label l = new Label(c, SWT.NONE);
+ l.dispose();
+ }
- public Object getAdapter(Class adapter) {
- if (ISourceViewer.class.equals(adapter)) {
- return JSPTextEditor.this.getSourceViewer();
- } else if (IContentOutlinePage.class.equals(adapter)) {
- if (fOutlinePage == null || fOutlinePage.getControl() == null
- || fOutlinePage.getControl().isDisposed()) {
- IStructuredModel internalModel = getModel();
- ContentOutlineConfiguration cfg = new JSPContentOutlineConfiguration(
- this);
- if (cfg != null) {
- ConfigurableContentOutlinePage outlinePage = new ConfigurableContentOutlinePage();
- outlinePage.setConfiguration(cfg);
- if (internalModel != null) {
- outlinePage.setInputContentTypeIdentifier(internalModel
- .getContentTypeIdentifier());
- outlinePage.setInput(internalModel);
- }
+ private ConfigurableContentOutlinePage fOutlinePage = null;
- if (fOutlinePageListener == null) {
- fOutlinePageListener = new OutlinePageListener();
- }
+ private OutlinePageListener fOutlinePageListener = null;
- outlinePage
- .addSelectionChangedListener(fOutlinePageListener);
- outlinePage.addDoubleClickListener(fOutlinePageListener);
+ private IPropertySheetPage fPropertySheetPage;
- fOutlinePage = outlinePage;
- }
- }
- return fOutlinePage;
- } else if (IPropertySheetPage.class == adapter) {
- if (fPropertySheetPage == null
- || fPropertySheetPage.getControl() == null
- || fPropertySheetPage.getControl().isDisposed()) {
- JSPPropertySheetConfiguration cfg = new JSPPropertySheetConfiguration();
- if (cfg != null) {
- ConfigurablePropertySheetPage propertySheetPage = new ConfigurablePropertySheetPage();
- propertySheetPage.setConfiguration(cfg);
- fPropertySheetPage = propertySheetPage;
- setSorter(cfg.getSorter(), propertySheetPage);
- }
- }
- return fPropertySheetPage;
- }
- return super.getAdapter(adapter);
- }
+ public Object getAdapter(Class adapter) {
+ if (ISourceViewer.class.equals(adapter)) {
+ return JSPTextEditor.this.getSourceViewer();
+ } else if (IContentOutlinePage.class.equals(adapter)) {
+ if (fOutlinePage == null || fOutlinePage.getControl() == null
+ || fOutlinePage.getControl().isDisposed()) {
+ IStructuredModel internalModel = getModel();
+ ContentOutlineConfiguration cfg = new JSPContentOutlineConfiguration(
+ this);
+ if (cfg != null) {
+ ConfigurableContentOutlinePage outlinePage = new ConfigurableContentOutlinePage();
+ outlinePage.setConfiguration(cfg);
+ if (internalModel != null) {
+ outlinePage.setInputContentTypeIdentifier(internalModel
+ .getContentTypeIdentifier());
+ outlinePage.setInput(internalModel);
+ }
- private void setSorter(PropertySheetSorter sorter,
- ConfigurablePropertySheetPage sheet) {
- try {
- Method method = PropertySheetPage.class.getDeclaredMethod(
- "setSorter", new Class[] { PropertySheetSorter.class });
- method.setAccessible(true);
- method.invoke(sheet, new Object[] { sorter });
- } catch (Exception e) {
- JspEditorPlugin.getPluginLog().logError(e);
+ if (fOutlinePageListener == null) {
+ fOutlinePageListener = new OutlinePageListener();
+ }
+
+ outlinePage
+ .addSelectionChangedListener(fOutlinePageListener);
+ outlinePage.addDoubleClickListener(fOutlinePageListener);
+
+ fOutlinePage = outlinePage;
}
+ }
+ return fOutlinePage;
+ } else if (IPropertySheetPage.class == adapter) {
+ if (fPropertySheetPage == null
+ || fPropertySheetPage.getControl() == null
+ || fPropertySheetPage.getControl().isDisposed()) {
+ JSPPropertySheetConfiguration cfg = new JSPPropertySheetConfiguration();
+ if (cfg != null) {
+ ConfigurablePropertySheetPage propertySheetPage = new ConfigurablePropertySheetPage();
+ propertySheetPage.setConfiguration(cfg);
+ fPropertySheetPage = propertySheetPage;
+ setSorter(cfg.getSorter(), propertySheetPage);
+ }
+ }
+ return fPropertySheetPage;
}
+ return super.getAdapter(adapter);
+ }
- public String getEditorId() {
- return JSPUIPlugin.ID;
+ private void setSorter(PropertySheetSorter sorter,
+ ConfigurablePropertySheetPage sheet) {
+ try {
+ Method method = PropertySheetPage.class.getDeclaredMethod(
+ "setSorter", new Class[] { PropertySheetSorter.class });
+ method.setAccessible(true);
+ method.invoke(sheet, new Object[] { sorter });
+ } catch (Exception e) {
+ JspEditorPlugin.getPluginLog().logError(e);
}
+ }
- public IStructuredTextOccurrenceStructureProvider getOccurrencePreferenceProvider() {
- return fOccurrenceModelUpdater;
- }
+ public String getEditorId() {
+ return JSPUIPlugin.ID;
+ }
- public void createPartControl(Composite parent) {
- super.createPartControl(parent);
+ public IStructuredTextOccurrenceStructureProvider getOccurrencePreferenceProvider() {
+ return fOccurrenceModelUpdater;
+ }
- StructuredTextOccurrenceStructureProviderRegistry registry = XmlEditorPlugin
- .getDefault().getOccurrenceStructureProviderRegistry(
- JspEditorPlugin.PLUGIN_ID);
- fOccurrenceModelUpdater = registry
- .getCurrentOccurrenceProvider(JspEditorPlugin.PLUGIN_ID);
+ public void createPartControl(Composite parent) {
+ super.createPartControl(parent);
- if (fOccurrenceModelUpdater != null)
- fOccurrenceModelUpdater.install(this, getTextViewer());
+ StructuredTextOccurrenceStructureProviderRegistry registry = XmlEditorPlugin
+ .getDefault().getOccurrenceStructureProviderRegistry(
+ JspEditorPlugin.PLUGIN_ID);
+ fOccurrenceModelUpdater = registry
+ .getCurrentOccurrenceProvider(JspEditorPlugin.PLUGIN_ID);
- installActivePropmtSupport();
+ if (fOccurrenceModelUpdater != null)
+ fOccurrenceModelUpdater.install(this, getTextViewer());
- createDrop();
- setModified(false);
- getSourceViewer().removeTextListener(this);
- getSourceViewer().addTextListener(this);
+ installActivePropmtSupport();
- Object dtid = getSourceViewer().getTextWidget().getData("DropTarget");
- if (dtid != null) {
- if (dtid instanceof DropTarget) {
- DropTarget dropTarget = (DropTarget) dtid;
- dropTarget.addDropListener(new DropTargetAdapter() {
- private FreeCaretStyledText getFreeCaretControl(
- Object sourceOrTarget) {
- if (sourceOrTarget == null)
- return null;
+ createDrop();
+ setModified(false);
+ getSourceViewer().removeTextListener(this);
+ getSourceViewer().addTextListener(this);
- Object control = null;
+ Object dtid = getSourceViewer().getTextWidget().getData("DropTarget");
+ if (dtid != null) {
+ if (dtid instanceof DropTarget) {
+ DropTarget dropTarget = (DropTarget) dtid;
+ dropTarget.addDropListener(new DropTargetAdapter() {
+ private FreeCaretStyledText getFreeCaretControl(
+ Object sourceOrTarget) {
+ if (sourceOrTarget == null)
+ return null;
- if (sourceOrTarget instanceof DropTarget) {
- control = ((DropTarget) sourceOrTarget)
- .getControl();
- } else if (sourceOrTarget instanceof DragSource) {
- control = ((DragSource) sourceOrTarget)
- .getControl();
- } else
- return null;
+ Object control = null;
- if (control instanceof FreeCaretStyledText)
- return (FreeCaretStyledText) control;
- return null;
- }
+ if (sourceOrTarget instanceof DropTarget) {
+ control = ((DropTarget) sourceOrTarget)
+ .getControl();
+ } else if (sourceOrTarget instanceof DragSource) {
+ control = ((DragSource) sourceOrTarget)
+ .getControl();
+ } else
+ return null;
- public void dragEnter(DropTargetEvent event) {
- getFreeCaretControl(event.widget).enableFreeCaret(true);
- }
+ if (control instanceof FreeCaretStyledText)
+ return (FreeCaretStyledText) control;
+ return null;
+ }
- public void dragLeave(DropTargetEvent event) {
- getFreeCaretControl(event.widget).enableFreeCaret(false);
- }
+ public void dragEnter(DropTargetEvent event) {
+ getFreeCaretControl(event.widget).enableFreeCaret(true);
+ }
- public void dragOperationChanged(DropTargetEvent event) {
- getFreeCaretControl(event.widget).enableFreeCaret(false);
- }
+ public void dragLeave(DropTargetEvent event) {
+ getFreeCaretControl(event.widget)
+ .enableFreeCaret(false);
+ }
- public void dragOver(DropTargetEvent event) {
- FreeCaretStyledText fcst = getFreeCaretControl(event.widget);
- int pos = getPosition(fcst, event.x, event.y);
- Point p = fcst.getLocationAtOffset(pos);
- fcst.myRedraw(p.x, p.y);
- }
+ public void dragOperationChanged(DropTargetEvent event) {
+ getFreeCaretControl(event.widget)
+ .enableFreeCaret(false);
+ }
- public void drop(DropTargetEvent event) {
- getFreeCaretControl(event.widget).enableFreeCaret(false);
- }
- });
- }
- }
- }
+ public void dragOver(DropTargetEvent event) {
+ FreeCaretStyledText fcst = getFreeCaretControl(event.widget);
+ int pos = getPosition(fcst, event.x, event.y);
+ Point p = fcst.getLocationAtOffset(pos);
+ fcst.myRedraw(p.x, p.y);
+ }
- protected ISourceViewer createSourceViewer(Composite parent,
- IVerticalRuler ruler, int styles) {
- ISourceViewer sv = super.createSourceViewer(parent, ruler, styles);
- sv.getTextWidget().addFocusListener(new TextFocusListener());
- return sv;
+ public void drop(DropTargetEvent event) {
+ getFreeCaretControl(event.widget)
+ .enableFreeCaret(false);
+ }
+ });
+ }
}
+ }
- protected StructuredTextViewer createStructedTextViewer(Composite parent,
- IVerticalRuler verticalRuler, int styles) {
- return new JSPStructuredTextViewer(parent, verticalRuler,
- getOverviewRuler(), isOverviewRulerVisible(), styles,
- parentEditor, this);
- }
+ protected ISourceViewer createSourceViewer(Composite parent,
+ IVerticalRuler ruler, int styles) {
+ ISourceViewer sv = super.createSourceViewer(parent, ruler, styles);
+ sv.getTextWidget().addFocusListener(new TextFocusListener());
+ return sv;
+ }
- class TextFocusListener extends FocusAdapter {
- public void focusLost(FocusEvent e) {
- if (JSPTextEditor.super.isDirty()) {
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- try {
- Thread.sleep(200);
- } catch (InterruptedException exc) {
- JspEditorPlugin.getPluginLog().logError(exc);
- }
- save();
- }
- });
- }
- }
- }
+ protected StructuredTextViewer createStructedTextViewer(Composite parent,
+ IVerticalRuler verticalRuler, int styles) {
+ return new JSPStructuredTextViewer(parent, verticalRuler,
+ getOverviewRuler(), isOverviewRulerVisible(), styles,
+ parentEditor, this);
+ }
- public void save() {
- if (!lock && isModified()) {
- lock = true;
+ class TextFocusListener extends FocusAdapter {
+ public void focusLost(FocusEvent e) {
+ if (JSPTextEditor.super.isDirty()) {
+ Display.getDefault().syncExec(new Runnable() {
+ public void run() {
try {
- FileAnyImpl f = (FileAnyImpl) getModelObject();
- if (f != null)
- f.edit(getSourceViewer().getDocument().get());
- } catch (Exception e) {
- JspEditorPlugin.getPluginLog().logError(e);
- } finally {
- setModified(false);
- lock = false;
+ Thread.sleep(200);
+ } catch (InterruptedException exc) {
+ JspEditorPlugin.getPluginLog().logError(exc);
}
- }
+ save();
+ }
+ });
+ }
}
+ }
- boolean modified = false;
-
- public void setModified(boolean set) {
- if (this.modified != set) {
- this.modified = set;
- if (set) {
- XModelObject o = getModelObject();
- if (o != null)
- o.setModified(true);
- }
- super.firePropertyChange(IEditorPart.PROP_DIRTY);
- }
+ public void save() {
+ if (!lock && isModified()) {
+ lock = true;
+ try {
+ FileAnyImpl f = (FileAnyImpl) getModelObject();
+ if (f != null)
+ f.edit(getSourceViewer().getDocument().get());
+ } catch (Exception e) {
+ JspEditorPlugin.getPluginLog().logError(e);
+ } finally {
+ setModified(false);
+ lock = false;
+ }
}
-
- public void updateModification() {
- //added by Max Areshkau
- //Fix for JBIDE-788
- getPageContext().refreshBundleValues();
-
- XModelObject object = getModelObject();
- if (object != null && !object.isModified() && isModified()) {
- setModified(false);
- } else {
- firePropertyChange(ITextEditor.PROP_DIRTY);
- }
- }
+ }
- public boolean isModified() {
- return modified;
- }
+ boolean modified = false;
- protected void doSetInput(IEditorInput input) throws CoreException {
- super.doSetInput(XModelObjectEditorInput.checkInput(input));
- if (getSourceViewer() != null
- && getSourceViewer().getDocument() != null) {
- getSourceViewer().removeTextListener(this);
- getSourceViewer().addTextListener(this);
- }
- if (listener != null)
- listener.dispose();
- listener = null;
+ public void setModified(boolean set) {
+ if (this.modified != set) {
+ this.modified = set;
+ if (set) {
XModelObject o = getModelObject();
- if (o instanceof FileAnyImpl) {
- listener = new BodyListenerImpl((FileAnyImpl) o);
- }
+ if (o != null)
+ o.setModified(true);
+ }
+ super.firePropertyChange(IEditorPart.PROP_DIRTY);
}
+ }
- boolean lock = false;
+ public void updateModification() {
+ // added by Max Areshkau
+ // Fix for JBIDE-788
+ getPageContext().refreshBundleValues();
- public boolean isDirty() {
- if (getEditorInput() instanceof IModelObjectEditorInput) {
- XModelObject o = getModelObject();
- if (o != null && o.isModified())
- return true;
- else {
- return isModified();
- }
- } else {
- return super.isDirty();
- }
+ XModelObject object = getModelObject();
+ if (object != null && !object.isModified() && isModified()) {
+ setModified(false);
+ } else {
+ firePropertyChange(ITextEditor.PROP_DIRTY);
}
+ }
- public void doSave(IProgressMonitor monitor) {
- XModelObject o = getModelObject();
- super.doSave(monitor);
- if (o != null && (monitor == null || !monitor.isCanceled())) {
- if (o != null)
- save();
- if (getEditorInput() instanceof ILocationProvider) {
- XModelObject p = o.getParent();
- if (p instanceof FolderImpl) {
- ((FolderImpl) p).saveChild(o);
- }
- } else {
- o.setModified(false);
- XModelObjectLoaderUtil.updateModifiedOnSave(o);
- }
- super.firePropertyChange(IEditorPart.PROP_DIRTY);
- }
+ public boolean isModified() {
+ return modified;
+ }
+
+ protected void doSetInput(IEditorInput input) throws CoreException {
+ super.doSetInput(XModelObjectEditorInput.checkInput(input));
+ if (getSourceViewer() != null
+ && getSourceViewer().getDocument() != null) {
+ getSourceViewer().removeTextListener(this);
+ getSourceViewer().addTextListener(this);
}
+ if (listener != null)
+ listener.dispose();
+ listener = null;
+ XModelObject o = getModelObject();
+ if (o instanceof FileAnyImpl) {
+ listener = new BodyListenerImpl((FileAnyImpl) o);
+ }
+ }
- public void firePropertyChangeDirty() {
- super.firePropertyChange(IEditorPart.PROP_DIRTY);
+ boolean lock = false;
+
+ public boolean isDirty() {
+ if (getEditorInput() instanceof IModelObjectEditorInput) {
+ XModelObject o = getModelObject();
+ if (o != null && o.isModified())
+ return true;
+ else {
+ return isModified();
+ }
+ } else {
+ return super.isDirty();
}
+ }
- public XModelObject getModelObject() {
- if (getEditorInput() instanceof IModelObjectEditorInput) {
- return ((IModelObjectEditorInput) getEditorInput())
- .getXModelObject();
+ public void doSave(IProgressMonitor monitor) {
+ XModelObject o = getModelObject();
+ super.doSave(monitor);
+ if (o != null && (monitor == null || !monitor.isCanceled())) {
+ if (o != null)
+ save();
+ if (getEditorInput() instanceof ILocationProvider) {
+ XModelObject p = o.getParent();
+ if (p instanceof FolderImpl) {
+ ((FolderImpl) p).saveChild(o);
}
- return null;
+ } else {
+ o.setModified(false);
+ XModelObjectLoaderUtil.updateModifiedOnSave(o);
+ }
+ super.firePropertyChange(IEditorPart.PROP_DIRTY);
}
+ }
- class TextEditorDropProviderImpl implements TextEditorDropProvider {
+ public void firePropertyChangeDirty() {
+ super.firePropertyChange(IEditorPart.PROP_DIRTY);
+ }
- public ISourceViewer getSourceViewer() {
- return JSPTextEditor.this.getSourceViewer();
- }
+ public XModelObject getModelObject() {
+ if (getEditorInput() instanceof IModelObjectEditorInput) {
+ return ((IModelObjectEditorInput) getEditorInput())
+ .getXModelObject();
+ }
+ return null;
+ }
- public XModelObject getModelObject() {
- return JSPTextEditor.this.getModelObject();
- }
+ class TextEditorDropProviderImpl implements TextEditorDropProvider {
- public void insert(Properties p) {
- PaletteInsertHelper.insertIntoEditor(getSourceViewer(), p);
- }
+ public ISourceViewer getSourceViewer() {
+ return JSPTextEditor.this.getSourceViewer();
+ }
+ public XModelObject getModelObject() {
+ return JSPTextEditor.this.getModelObject();
}
- public void textChanged(TextEvent event) {
- if (event.getDocumentEvent() != null) {
- setModified(true);
- }
+ public void insert(Properties p) {
+ PaletteInsertHelper.insertIntoEditor(getSourceViewer(), p);
}
- public void doRevertToSaved() {
- save();
- XModelObject o = getModelObject();
- if (o == null) {
- super.doRevertToSaved();
- return;
- }
- Properties p = new Properties();
- XActionInvoker.invoke("DiscardActions.Discard", o, p);
- if (!"true".equals(p.getProperty("done")))
- return;
- super.doRevertToSaved();
- if (o.isModified())
- o.setModified(false);
- modified = false;
- firePropertyChange(IEditorPart.PROP_DIRTY);
- updatePartControl(getEditorInput());
+ }
+
+ public void textChanged(TextEvent event) {
+ if (event.getDocumentEvent() != null) {
+ setModified(true);
}
+ }
- public IAnnotationModel getAnnotationModel() {
- return getSourceViewer().getAnnotationModel();
+ public void doRevertToSaved() {
+ save();
+ XModelObject o = getModelObject();
+ if (o == null) {
+ super.doRevertToSaved();
+ return;
}
+ Properties p = new Properties();
+ XActionInvoker.invoke("DiscardActions.Discard", o, p);
+ if (!"true".equals(p.getProperty("done")))
+ return;
+ super.doRevertToSaved();
+ if (o.isModified())
+ o.setModified(false);
+ modified = false;
+ firePropertyChange(IEditorPart.PROP_DIRTY);
+ updatePartControl(getEditorInput());
+ }
- private WTPTextJspKbConnector wtpTextJspKbConnector;
+ public IAnnotationModel getAnnotationModel() {
+ return getSourceViewer().getAnnotationModel();
+ }
- private void installActivePropmtSupport() {
- try {
- IDocument document = getTextViewer().getDocument();
- IStructuredModel model = null;
- if (getDocumentProvider() instanceof IModelProvider) {
- model = ((IModelProvider) getDocumentProvider())
- .getModel(getEditorInput());
- } else {
- if (document instanceof IStructuredDocument) {
- model = getModel();
- }
- }
- if (wtpTextJspKbConnector == null
- && model != null
- && (getContentType().toLowerCase().indexOf("jsp") != -1 || getContentType()
- .toLowerCase().indexOf("html") != -1)) {
- wtpTextJspKbConnector = new WTPTextJspKbConnector(
- getEditorInput(), document, model);
- wtpTextJspKbConnector.setTaglibManagerProvider(parentEditor);
- }
- } catch (Exception x) {
- JspEditorPlugin.getPluginLog().logError("Error while installing active prpmpting support", x);
- }
- }
+ private WTPTextJspKbConnector wtpTextJspKbConnector;
- private String getContentType() {
- String type = null;
- try {
- type = getModel().getContentTypeIdentifier();
- } finally {
- if (type == null)
- type = "";
+ private void installActivePropmtSupport() {
+ try {
+ IDocument document = getTextViewer().getDocument();
+ IStructuredModel model = null;
+ if (getDocumentProvider() instanceof IModelProvider) {
+ model = ((IModelProvider) getDocumentProvider())
+ .getModel(getEditorInput());
+ } else {
+ if (document instanceof IStructuredDocument) {
+ model = getModel();
}
- return type;
+ }
+ if (wtpTextJspKbConnector == null
+ && model != null
+ && (getContentType().toLowerCase().indexOf("jsp") != -1 || getContentType()
+ .toLowerCase().indexOf("html") != -1)) {
+ wtpTextJspKbConnector = new WTPTextJspKbConnector(
+ getEditorInput(), document, model);
+ wtpTextJspKbConnector.setTaglibManagerProvider(parentEditor);
+ }
+ } catch (Exception x) {
+ JspEditorPlugin.getPluginLog().logError(
+ "Error while installing active prpmpting support", x);
}
+ }
- public WTPTextJspKbConnector getWTPTextJspKbConnector() {
- return wtpTextJspKbConnector;
+ private String getContentType() {
+ String type = null;
+ try {
+ type = getModel().getContentTypeIdentifier();
+ } finally {
+ if (type == null)
+ type = "";
}
+ return type;
+ }
- public static class JSPStructuredTextViewer extends StructuredTextViewer
- implements VpeTaglibManagerProvider, IIgnoreSelection {
+ public WTPTextJspKbConnector getWTPTextJspKbConnector() {
+ return wtpTextJspKbConnector;
+ }
- boolean insertFromPallete = false;
+ public static class JSPStructuredTextViewer extends StructuredTextViewer
+ implements VpeTaglibManagerProvider, IIgnoreSelection {
- private VpeTaglibManagerProvider provider;
+ boolean insertFromPallete = false;
- private JSPTextEditor editor;
+ private VpeTaglibManagerProvider provider;
- private boolean ignore = false;
+ private JSPTextEditor editor;
- public JSPStructuredTextViewer(Composite parent,
- IVerticalRuler verticalRuler, int styles) {
- super(parent, verticalRuler, null, false, styles);
- }
+ private boolean ignore = false;
- public JSPStructuredTextViewer(Composite parent,
- IVerticalRuler verticalRuler, IOverviewRuler overviewRuler,
- boolean showAnnotationsOverview, int styles,
- VpeTaglibManagerProvider provider, JSPTextEditor editor) {
- super(parent, verticalRuler, overviewRuler,
- showAnnotationsOverview, styles);
- this.provider = provider;
- this.editor = editor;
- }
+ public JSPStructuredTextViewer(Composite parent,
+ IVerticalRuler verticalRuler, int styles) {
+ super(parent, verticalRuler, null, false, styles);
+ }
- protected StyledText createTextWidget(Composite parent, int styles) {
- return new FreeCaretStyledText(parent, styles);
- }
+ public JSPStructuredTextViewer(Composite parent,
+ IVerticalRuler verticalRuler, IOverviewRuler overviewRuler,
+ boolean showAnnotationsOverview, int styles,
+ VpeTaglibManagerProvider provider, JSPTextEditor editor) {
+ super(parent, verticalRuler, overviewRuler,
+ showAnnotationsOverview, styles);
+ this.provider = provider;
+ this.editor = editor;
+ }
- public VpeTaglibManager getTaglibManager() {
- //added by Max Areshkau
- //Fix for JBIDE-788
- if (getEditor() != null) {
- if(getEditor().getPageContext() instanceof VpeTaglibManager)
-
-
- return (VpeTaglibManager)getEditor().getPageContext();
- }
- return null;
- }
+ protected StyledText createTextWidget(Composite parent, int styles) {
+ return new FreeCaretStyledText(parent, styles);
+ }
- public boolean doesIgnore() {
- return ignore;
- }
+ public VpeTaglibManager getTaglibManager() {
+ // added by Max Areshkau
+ // Fix for JBIDE-788
+ if (getEditor() != null) {
+ if (getEditor().getPageContext() instanceof VpeTaglibManager)
- public void setIgnore(boolean ignore) {
- this.ignore = ignore;
- }
+ return (VpeTaglibManager) getEditor().getPageContext();
+ }
+ return null;
+ }
- public void doOperation(int operation) {
- if (operation == UNDO || operation == REDO
- || operation == FORMAT_DOCUMENT
- || operation == FORMAT_ACTIVE_ELEMENTS) {
- if (editor.getVPEController() != null) {
- editor.getVPEController().preLongOperation();
- }
- }
+ public boolean doesIgnore() {
+ return ignore;
+ }
- super.doOperation(operation);
+ public void setIgnore(boolean ignore) {
+ this.ignore = ignore;
+ }
- if (operation == UNDO || operation == REDO
- || operation == FORMAT_DOCUMENT
- || operation == FORMAT_ACTIVE_ELEMENTS) {
- if (editor.getVPEController() != null) {
- editor.getVPEController().postLongOperation();
- }
- }
+ public void doOperation(int operation) {
+ if (operation == UNDO || operation == REDO
+ || operation == FORMAT_DOCUMENT
+ || operation == FORMAT_ACTIVE_ELEMENTS) {
+ if (editor.getVPEController() != null) {
+ editor.getVPEController().preLongOperation();
}
-
- protected void handleDispose() {
- if (editor != null && editor.getSourceViewer() != null && editor.getSourceViewer().getTextWidget() != null && editor.getVPEController() != null) {
- StyledText widget = editor.getSourceViewer().getTextWidget();
- widget.removeSelectionListener(editor.getVPEController());
- }
- super.handleDispose();
- editor = null;
- provider = null;
- }
-
+ }
- /**
- * @return the editor
- */
- //Added By Max Areshkau
- //Fix for JBIDE-788
- public JSPTextEditor getEditor() {
- return editor;
- }
+ super.doOperation(operation);
- /**
- * @param editor the editor to set
- */
- //Added By Max Areshkau
- //Fix for JBIDE-788
- public void setEditor(JSPTextEditor editor) {
- this.editor = editor;
+ if (operation == UNDO || operation == REDO
+ || operation == FORMAT_DOCUMENT
+ || operation == FORMAT_ACTIVE_ELEMENTS) {
+ if (editor.getVPEController() != null) {
+ editor.getVPEController().postLongOperation();
}
-
+ }
}
- public JSPMultiPageEditor getParentEditor() {
- return parentEditor;
- }
- public void setVPEController(IVisualController c) {
- vpeController = c;
+ protected void handleDispose() {
+ if (editor != null && editor.getSourceViewer() != null
+ && editor.getSourceViewer().getTextWidget() != null
+ && editor.getVPEController() != null) {
+ StyledText widget = editor.getSourceViewer().getTextWidget();
+ widget.removeSelectionListener(editor.getVPEController());
+ }
+ super.handleDispose();
+ editor = null;
+ provider = null;
}
- public IVisualController getVPEController() {
- return vpeController;
+ /**
+ * @return the editor
+ */
+ // Added By Max Areshkau
+ // Fix for JBIDE-788
+ public JSPTextEditor getEditor() {
+ return editor;
}
- public void runDropCommand(final String flavor, final String data) {
- XModelBuffer b = XModelTransferBuffer.getInstance().getBuffer();
- final XModelObject o = b == null ? null : b.source();
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if(o != null && !XModelTransferBuffer.getInstance().isEnabled()) {
- XModelTransferBuffer.getInstance().enable();
- XModelTransferBuffer.getInstance().getBuffer().addSource(o);
- }
- try {
- DropData dropData = new DropData(flavor,
- data,
- getEditorInput(), getSourceViewer(),
- getSelectionProvider());
- dropData.setAttributeName(dropContext.getAttributeName());
- IDropCommand dropCommand = DropCommandFactory.getInstance().getDropCommand(flavor, JSPTagProposalFactory.getInstance());
-
- boolean promptAttributes = "yes".equals(VpePreference.ALWAYS_REQUEST_FOR_ATTRIBUTE.getValue());
- dropCommand.getDefaultModel().setPromptForTagAttributesRequired(promptAttributes);
- dropCommand.execute(dropData);
- } finally {
- XModelTransferBuffer.getInstance().disable();
- }
- }
- });
+ /**
+ * @param editor
+ * the editor to set
+ */
+ // Added By Max Areshkau
+ // Fix for JBIDE-788
+ public void setEditor(JSPTextEditor editor) {
+ this.editor = editor;
}
- private void createDrop() {
- DropTarget target = new DropTarget(getSourceViewer().getTextWidget(),
- DND.DROP_MOVE | DND.DROP_COPY);
- Transfer[] types = new Transfer[] { ModelTransfer.getInstance(),
- HTMLTransfer.getInstance(), TextTransfer.getInstance(),
- FileTransfer.getInstance() };
- target.setTransfer(types);
- target.addDropListener(new DTL());
- }
+ }
- DropContext dropContext = new DropContext();
+ public JSPMultiPageEditor getParentEditor() {
+ return parentEditor;
+ }
- class DTL implements DropTargetListener {
- int lastpos = -1;
+ public void setVPEController(IVisualController c) {
+ vpeController = c;
+ }
- int lastdetail = -1;
+ public IVisualController getVPEController() {
+ return vpeController;
+ }
- public void dragEnter(DropTargetEvent event) {
- lastpos = -1;
+ public void runDropCommand(final String flavor, final String data) {
+ XModelBuffer b = XModelTransferBuffer.getInstance().getBuffer();
+ final XModelObject o = b == null ? null : b.source();
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ if (o != null
+ && !XModelTransferBuffer.getInstance().isEnabled()) {
+ XModelTransferBuffer.getInstance().enable();
+ XModelTransferBuffer.getInstance().getBuffer().addSource(o);
}
+ try {
+ DropData dropData = new DropData(flavor, data,
+ getEditorInput(), getSourceViewer(),
+ getSelectionProvider());
+ dropData.setAttributeName(dropContext.getAttributeName());
+ IDropCommand dropCommand = DropCommandFactory.getInstance()
+ .getDropCommand(flavor,
+ JSPTagProposalFactory.getInstance());
- public void dragLeave(DropTargetEvent event) {
- lastpos = -1;
+ boolean promptAttributes = "yes"
+ .equals(VpePreference.ALWAYS_REQUEST_FOR_ATTRIBUTE
+ .getValue());
+ dropCommand
+ .getDefaultModel()
+ .setPromptForTagAttributesRequired(promptAttributes);
+ dropCommand.execute(dropData);
+ } finally {
+ XModelTransferBuffer.getInstance().disable();
}
+ }
+ });
+ }
- public void dragOperationChanged(DropTargetEvent event) {
- }
+ private void createDrop() {
+ DropTarget target = new DropTarget(getSourceViewer().getTextWidget(),
+ DND.DROP_MOVE | DND.DROP_COPY);
+ Transfer[] types = new Transfer[] {
+ /*
+ * Added by Dzmitry Sakovich (dsakovich(a)exadel.com) Fix for
+ * JBIDE-1836
+ */
+ // ModelTransfer.getInstance(),
+ HTMLTransfer.getInstance(), TextTransfer.getInstance(),
+ FileTransfer.getInstance() };
+ target.setTransfer(types);
+ target.addDropListener(new DTL());
+ }
- public void dragOver(DropTargetEvent event) {
- if (!isEditable()
- || (getModelObject() != null && !getModelObject()
- .isObjectEditable())) {
- event.detail = DND.DROP_NONE;
- return;
- }
- dropContext.setDropTargetEvent(event);
- if (dropContext.getFlavor() == null) {
- event.detail = DND.DROP_NONE;
- return;
- }
- // Drop from VPE to Source is forbidden
- if (dropContext.getFlavor().equals("text/html")) {
- if (InnerDragBuffer.object != null) {
- event.detail = DND.DROP_NONE;
- }
- return;
- }
- int pos = getPosition(event.x, event.y);
- if (lastpos == pos && pos >= 0) {
- pos = lastpos;
- event.detail = lastdetail;
- return;
- }
- lastpos = pos;
- dropContext.clean();
- getSourceViewer().getDocument();
- IndexedRegion region = getModel().getIndexedRegion(pos);
- if (region instanceof ElementImpl) {
- ElementImpl jspElement = (ElementImpl) region;
- NamedNodeMap attributes = jspElement.getAttributes();
- if (pos == jspElement.getStartOffset()
- || pos == jspElement.getEndStartOffset()) {
- event.detail = lastdetail = DND.DROP_MOVE;
- return;
- }
- for (int i = 0; i < attributes.getLength(); i++) {
- Node attribute = attributes.item(i);
- if (attribute instanceof AttrImpl) {
- AttrImpl jspAttr = (AttrImpl) attribute;
- ITextRegion valueRegion = jspAttr.getValueRegion();
- if (valueRegion == null) {
- event.detail = lastdetail = DND.DROP_NONE;
- return;
- }
- int startPos = jspElement.getStartOffset()
- + valueRegion.getStart();
- int endPos = jspElement.getStartOffset()
- + valueRegion.getTextEnd();
- if (pos > startPos && pos < endPos) {
- dropContext.setOverAttributeValue(true);
- dropContext.setAttributeName(jspAttr.getNodeName());
- event.detail = lastdetail = DND.DROP_MOVE;
- return;
- }
- }
- }
- event.detail = lastdetail = DND.DROP_NONE;
- } else if (region instanceof Text
- && isInsideResponseRedirect((Text) region, pos
- - region.getStartOffset())) {
- dropContext.setOverAttributeValue(true);
- event.detail = lastdetail = DND.DROP_MOVE;
- } else if (region instanceof Text) {
- event.detail = lastdetail = DND.DROP_MOVE;
- } else if (region instanceof DocumentType) {
- event.detail = lastdetail = DND.DROP_NONE;
- } else if (region == null) {
- //new place
- event.detail = lastdetail = DND.DROP_MOVE;
- }
- }
+ DropContext dropContext = new DropContext();
- public void drop(DropTargetEvent event) {
- int offset = getPosition(event.x, event.y);
- selectAndReveal(offset, 0);
- dropContext.runDropCommand(JSPTextEditor.this, event);
- }
+ class DTL implements DropTargetListener {
+ int lastpos = -1;
- public void dropAccept(DropTargetEvent event) {
- }
+ int lastdetail = -1;
+ public void dragEnter(DropTargetEvent event) {
+ lastpos = -1;
}
- private int getPosition(int x, int y) {
- ISourceViewer v = getSourceViewer();
- return v == null ? 0 : getPosition(v.getTextWidget(), x, y);
+ public void dragLeave(DropTargetEvent event) {
+ lastpos = -1;
}
- private int getPosition(StyledText t, int x, int y) {
- if(t == null || t.isDisposed()) return 0;
- Point pp = t.toControl(x, y);
- x = pp.x;
- y = pp.y;
- int lineIndex = (t.getTopPixel() + y) / t.getLineHeight();
- if (lineIndex >= t.getLineCount()) {
- return t.getCharCount();
- } else {
- int c = 0;
- try {
- c = t.getOffsetAtLocation(new Point(x, y));
- if (c < 0) c = 0;
- } catch (IllegalArgumentException ex) {
- //do not log, catching that exception is
- //the way to know that we are out of line.
- if (lineIndex + 1 >= t.getLineCount()) {
- return t.getCharCount();
- }
- c = t.getOffsetAtLine(lineIndex + 1)
- - (t.getLineDelimiter() == null
- ? 0 : t.getLineDelimiter().length());
+ public void dragOperationChanged(DropTargetEvent event) {
+ }
+
+ public void dragOver(DropTargetEvent event) {
+ if (!isEditable()
+ || (getModelObject() != null && !getModelObject()
+ .isObjectEditable())) {
+ event.detail = DND.DROP_NONE;
+ return;
+ }
+ dropContext.setDropTargetEvent(event);
+ if (dropContext.getFlavor() == null) {
+ event.detail = DND.DROP_NONE;
+ return;
+ }
+ // Drop from VPE to Source is forbidden
+ if (dropContext.getFlavor().equals("text/html")) {
+ if (InnerDragBuffer.object != null) {
+ event.detail = DND.DROP_NONE;
+ }
+ return;
+ }
+ int pos = getPosition(event.x, event.y);
+ if (lastpos == pos && pos >= 0) {
+ pos = lastpos;
+ event.detail = lastdetail;
+ return;
+ }
+ lastpos = pos;
+ dropContext.clean();
+ getSourceViewer().getDocument();
+ IndexedRegion region = getModel().getIndexedRegion(pos);
+ if (region instanceof ElementImpl) {
+ ElementImpl jspElement = (ElementImpl) region;
+ NamedNodeMap attributes = jspElement.getAttributes();
+ if (pos == jspElement.getStartOffset()
+ || pos == jspElement.getEndStartOffset()) {
+ event.detail = lastdetail = DND.DROP_MOVE;
+ return;
+ }
+ for (int i = 0; i < attributes.getLength(); i++) {
+ Node attribute = attributes.item(i);
+ if (attribute instanceof AttrImpl) {
+ AttrImpl jspAttr = (AttrImpl) attribute;
+ ITextRegion valueRegion = jspAttr.getValueRegion();
+ if (valueRegion == null) {
+ event.detail = lastdetail = DND.DROP_NONE;
+ return;
}
- return c;
+ int startPos = jspElement.getStartOffset()
+ + valueRegion.getStart();
+ int endPos = jspElement.getStartOffset()
+ + valueRegion.getTextEnd();
+ if (pos > startPos && pos < endPos) {
+ dropContext.setOverAttributeValue(true);
+ dropContext.setAttributeName(jspAttr.getNodeName());
+ event.detail = lastdetail = DND.DROP_MOVE;
+ return;
+ }
+ }
}
+ event.detail = lastdetail = DND.DROP_NONE;
+ } else if (region instanceof Text
+ && isInsideResponseRedirect((Text) region, pos
+ - region.getStartOffset())) {
+ dropContext.setOverAttributeValue(true);
+ event.detail = lastdetail = DND.DROP_MOVE;
+ } else if (region instanceof Text) {
+ event.detail = lastdetail = DND.DROP_MOVE;
+ } else if (region instanceof DocumentType) {
+ event.detail = lastdetail = DND.DROP_NONE;
+ } else if (region == null) {
+ // new place
+ event.detail = lastdetail = DND.DROP_MOVE;
+ }
}
- public String[] getConfigurationPoints() {
- String contentTypeIdentifierID = null;
- if (getModel() != null)
- contentTypeIdentifierID = getModel().getContentTypeIdentifier();
- return ConfigurationPointCalculator.getConfigurationPoints(this,
- contentTypeIdentifierID, ConfigurationPointCalculator.SOURCE,
- StructuredTextEditor.class);
+ public void drop(DropTargetEvent event) {
+ int offset = getPosition(event.x, event.y);
+ selectAndReveal(offset, 0);
+ dropContext.runDropCommand(JSPTextEditor.this, event);
}
- public void formatTextRegion(IDocument document, IRegion region) {
- SourceViewerConfiguration conf = getSourceViewerConfiguration();
+ public void dropAccept(DropTargetEvent event) {
+ }
- if (conf instanceof StructuredTextViewerConfiguration) {
- StructuredTextViewerConfiguration stvc = (StructuredTextViewerConfiguration) conf;
- IContentFormatter f = stvc.getContentFormatter(getSourceViewer());
- f.format(document, region);
+ }
+
+ private int getPosition(int x, int y) {
+ ISourceViewer v = getSourceViewer();
+ return v == null ? 0 : getPosition(v.getTextWidget(), x, y);
+ }
+
+ private int getPosition(StyledText t, int x, int y) {
+ if (t == null || t.isDisposed())
+ return 0;
+ Point pp = t.toControl(x, y);
+ x = pp.x;
+ y = pp.y;
+ int lineIndex = (t.getTopPixel() + y) / t.getLineHeight();
+ if (lineIndex >= t.getLineCount()) {
+ return t.getCharCount();
+ } else {
+ int c = 0;
+ try {
+ c = t.getOffsetAtLocation(new Point(x, y));
+ if (c < 0)
+ c = 0;
+ } catch (IllegalArgumentException ex) {
+ // do not log, catching that exception is
+ // the way to know that we are out of line.
+ if (lineIndex + 1 >= t.getLineCount()) {
+ return t.getCharCount();
}
+ c = t.getOffsetAtLine(lineIndex + 1)
+ - (t.getLineDelimiter() == null ? 0 : t
+ .getLineDelimiter().length());
+ }
+ return c;
}
+ }
- Point storedSelection = new Point(0, 0);
+ public String[] getConfigurationPoints() {
+ String contentTypeIdentifierID = null;
+ if (getModel() != null)
+ contentTypeIdentifierID = getModel().getContentTypeIdentifier();
+ return ConfigurationPointCalculator.getConfigurationPoints(this,
+ contentTypeIdentifierID, ConfigurationPointCalculator.SOURCE,
+ StructuredTextEditor.class);
+ }
- protected void handleCursorPositionChanged() {
- super.handleCursorPositionChanged();
- ISelection selection = getSelectionProvider().getSelection();
- Point p = getTextViewer().getTextWidget().getSelection();
- if (storedSelection == null || !storedSelection.equals(p)) {
- storedSelection = p;
- if (selection instanceof ITextSelection) {
- ITextSelection ts = (ITextSelection) selection;
- if (ts.getLength() == 0) {
- if (vpeController != null) {
- vpeController
- .selectionChanged(new SelectionChangedEvent(
- getSelectionProvider(),
- getSelectionProvider().getSelection()));
- }
- }
- }
+ public void formatTextRegion(IDocument document, IRegion region) {
+ SourceViewerConfiguration conf = getSourceViewerConfiguration();
+
+ if (conf instanceof StructuredTextViewerConfiguration) {
+ StructuredTextViewerConfiguration stvc = (StructuredTextViewerConfiguration) conf;
+ IContentFormatter f = stvc.getContentFormatter(getSourceViewer());
+ f.format(document, region);
+ }
+ }
+
+ Point storedSelection = new Point(0, 0);
+
+ protected void handleCursorPositionChanged() {
+ super.handleCursorPositionChanged();
+ ISelection selection = getSelectionProvider().getSelection();
+ Point p = getTextViewer().getTextWidget().getSelection();
+ if (storedSelection == null || !storedSelection.equals(p)) {
+ storedSelection = p;
+ if (selection instanceof ITextSelection) {
+ ITextSelection ts = (ITextSelection) selection;
+ if (ts.getLength() == 0) {
+ if (vpeController != null) {
+ vpeController
+ .selectionChanged(new SelectionChangedEvent(
+ getSelectionProvider(),
+ getSelectionProvider().getSelection()));
+ }
}
+ }
}
+ }
- static int firingSelectionFailedCount = 0;
+ static int firingSelectionFailedCount = 0;
- private class OutlinePageListener implements IDoubleClickListener,
- ISelectionChangedListener {
- public void doubleClick(DoubleClickEvent event) {
- if (event.getSelection().isEmpty())
- return;
+ private class OutlinePageListener implements IDoubleClickListener,
+ ISelectionChangedListener {
+ public void doubleClick(DoubleClickEvent event) {
+ if (event.getSelection().isEmpty())
+ return;
- int start = -1;
- int length = 0;
- if (event.getSelection() instanceof IStructuredSelection) {
- ISelection currentSelection = getSelectionProvider()
- .getSelection();
- if (currentSelection instanceof IStructuredSelection) {
- Object current = ((IStructuredSelection) currentSelection)
- .toArray();
- Object newSelection = ((IStructuredSelection) event
- .getSelection()).toArray();
- if (!current.equals(newSelection)) {
- IStructuredSelection selection = (IStructuredSelection) event
- .getSelection();
- Object o = selection.getFirstElement();
- if (o instanceof IndexedRegion) {
- start = ((IndexedRegion) o).getStartOffset();
- length = ((IndexedRegion) o).getEndOffset() - start;
- } else if (o instanceof ITextRegion) {
- start = ((ITextRegion) o).getStart();
- length = ((ITextRegion) o).getEnd() - start;
- } else if (o instanceof IRegion) {
- start = ((ITextRegion) o).getStart();
- length = ((ITextRegion) o).getLength();
- }
- }
- }
- } else if (event.getSelection() instanceof ITextSelection) {
- start = ((ITextSelection) event.getSelection()).getOffset();
- length = ((ITextSelection) event.getSelection()).getLength();
+ int start = -1;
+ int length = 0;
+ if (event.getSelection() instanceof IStructuredSelection) {
+ ISelection currentSelection = getSelectionProvider()
+ .getSelection();
+ if (currentSelection instanceof IStructuredSelection) {
+ Object current = ((IStructuredSelection) currentSelection)
+ .toArray();
+ Object newSelection = ((IStructuredSelection) event
+ .getSelection()).toArray();
+ if (!current.equals(newSelection)) {
+ IStructuredSelection selection = (IStructuredSelection) event
+ .getSelection();
+ Object o = selection.getFirstElement();
+ if (o instanceof IndexedRegion) {
+ start = ((IndexedRegion) o).getStartOffset();
+ length = ((IndexedRegion) o).getEndOffset() - start;
+ } else if (o instanceof ITextRegion) {
+ start = ((ITextRegion) o).getStart();
+ length = ((ITextRegion) o).getEnd() - start;
+ } else if (o instanceof IRegion) {
+ start = ((ITextRegion) o).getStart();
+ length = ((ITextRegion) o).getLength();
}
- if (start > -1) {
- getSourceViewer().setRangeIndication(start, length, false);
- selectAndReveal(start, length);
- }
+ }
}
+ } else if (event.getSelection() instanceof ITextSelection) {
+ start = ((ITextSelection) event.getSelection()).getOffset();
+ length = ((ITextSelection) event.getSelection()).getLength();
+ }
+ if (start > -1) {
+ getSourceViewer().setRangeIndication(start, length, false);
+ selectAndReveal(start, length);
+ }
+ }
- public void selectionChanged(SelectionChangedEvent event) {
- if (event.getSelection().isEmpty() || isFiringSelection())
- return;
+ public void selectionChanged(SelectionChangedEvent event) {
+ if (event.getSelection().isEmpty() || isFiringSelection())
+ return;
- boolean ignoreSelection = false;
- if (getSourceViewer() != null
- && getSourceViewer() instanceof IIgnoreSelection) {
- IIgnoreSelection is = ((IIgnoreSelection) getSourceViewer());
- ignoreSelection = is.doesIgnore();
- }
- if (getSourceViewer() != null
- && getSourceViewer().getTextWidget() != null
- && !getSourceViewer().getTextWidget().isDisposed()
- && !getSourceViewer().getTextWidget().isFocusControl()
- && !ignoreSelection) {
- int start = -1;
- int length = 0;
- if (event.getSelection() instanceof IStructuredSelection) {
- ISelection current = getSelectionProvider().getSelection();
- if (current instanceof IStructuredSelection) {
- Object[] currentSelection = ((IStructuredSelection) current)
- .toArray();
- Object[] newSelection = ((IStructuredSelection) event
- .getSelection()).toArray();
- if (!Arrays.equals(currentSelection, newSelection)) {
- if (newSelection.length > 0) {
- /*
- * No ordering is guaranteed for multiple
- * selection
- */
- Object o = newSelection[0];
- if (o instanceof IndexedRegion) {
- start = ((IndexedRegion) o)
- .getStartOffset();
- int end = ((IndexedRegion) o)
- .getEndOffset();
- if (newSelection.length > 1) {
- for (int i = 1; i < newSelection.length; i++) {
- start = Math
- .min(
- start,
- ((IndexedRegion) newSelection[i])
- .getStartOffset());
- end = Math
- .max(
- end,
- ((IndexedRegion) newSelection[i])
- .getEndOffset());
- }
- length = end - start;
- }
- } else if (o instanceof ITextRegion) {
- start = ((ITextRegion) o).getStart();
- int end = ((ITextRegion) o).getEnd();
- if (newSelection.length > 1) {
- for (int i = 1; i < newSelection.length; i++) {
- start = Math
- .min(
- start,
- ((ITextRegion) newSelection[i])
- .getStart());
- end = Math
- .max(
- end,
- ((ITextRegion) newSelection[i])
- .getEnd());
- }
- length = end - start;
- }
- } else if (o instanceof IRegion) {
- start = ((IRegion) o).getOffset();
- int end = start + ((IRegion) o).getLength();
- if (newSelection.length > 1) {
- for (int i = 1; i < newSelection.length; i++) {
- start = Math.min(start,
- ((IRegion) newSelection[i])
- .getOffset());
- end = Math
- .max(
- end,
- ((IRegion) newSelection[i])
- .getOffset()
- + ((IRegion) newSelection[i])
- .getLength());
- }
- length = end - start;
- }
- }
- }
- }
+ boolean ignoreSelection = false;
+ if (getSourceViewer() != null
+ && getSourceViewer() instanceof IIgnoreSelection) {
+ IIgnoreSelection is = ((IIgnoreSelection) getSourceViewer());
+ ignoreSelection = is.doesIgnore();
+ }
+ if (getSourceViewer() != null
+ && getSourceViewer().getTextWidget() != null
+ && !getSourceViewer().getTextWidget().isDisposed()
+ && !getSourceViewer().getTextWidget().isFocusControl()
+ && !ignoreSelection) {
+ int start = -1;
+ int length = 0;
+ if (event.getSelection() instanceof IStructuredSelection) {
+ ISelection current = getSelectionProvider().getSelection();
+ if (current instanceof IStructuredSelection) {
+ Object[] currentSelection = ((IStructuredSelection) current)
+ .toArray();
+ Object[] newSelection = ((IStructuredSelection) event
+ .getSelection()).toArray();
+ if (!Arrays.equals(currentSelection, newSelection)) {
+ if (newSelection.length > 0) {
+ /*
+ * No ordering is guaranteed for multiple
+ * selection
+ */
+ Object o = newSelection[0];
+ if (o instanceof IndexedRegion) {
+ start = ((IndexedRegion) o)
+ .getStartOffset();
+ int end = ((IndexedRegion) o)
+ .getEndOffset();
+ if (newSelection.length > 1) {
+ for (int i = 1; i < newSelection.length; i++) {
+ start = Math
+ .min(
+ start,
+ ((IndexedRegion) newSelection[i])
+ .getStartOffset());
+ end = Math
+ .max(
+ end,
+ ((IndexedRegion) newSelection[i])
+ .getEndOffset());
}
- } else if (event.getSelection() instanceof ITextSelection) {
- start = ((ITextSelection) event.getSelection()).getOffset();
+ length = end - start;
+ }
+ } else if (o instanceof ITextRegion) {
+ start = ((ITextRegion) o).getStart();
+ int end = ((ITextRegion) o).getEnd();
+ if (newSelection.length > 1) {
+ for (int i = 1; i < newSelection.length; i++) {
+ start = Math
+ .min(
+ start,
+ ((ITextRegion) newSelection[i])
+ .getStart());
+ end = Math
+ .max(
+ end,
+ ((ITextRegion) newSelection[i])
+ .getEnd());
+ }
+ length = end - start;
+ }
+ } else if (o instanceof IRegion) {
+ start = ((IRegion) o).getOffset();
+ int end = start + ((IRegion) o).getLength();
+ if (newSelection.length > 1) {
+ for (int i = 1; i < newSelection.length; i++) {
+ start = Math.min(start,
+ ((IRegion) newSelection[i])
+ .getOffset());
+ end = Math
+ .max(
+ end,
+ ((IRegion) newSelection[i])
+ .getOffset()
+ + ((IRegion) newSelection[i])
+ .getLength());
+ }
+ length = end - start;
+ }
}
- if (start > -1) {
- updateRangeIndication0(event.getSelection());
- selectAndReveal(start, length);
- }
+ }
}
+ }
+ } else if (event.getSelection() instanceof ITextSelection) {
+ start = ((ITextSelection) event.getSelection()).getOffset();
}
+ if (start > -1) {
+ updateRangeIndication0(event.getSelection());
+ selectAndReveal(start, length);
+ }
+ }
+ }
- Method m = null;
+ Method m = null;
- private boolean isFiringSelection() {
- if (getSelectionProvider() == null)
- return false;
- if (firingSelectionFailedCount > 0)
- return false;
- try {
- if (m == null) {
- Class c = getSelectionProvider().getClass();
- m = c.getDeclaredMethod("isFiringSelection", new Class[0]);
- m.setAccessible(true);
- }
- Boolean b = (Boolean) m.invoke(getSelectionProvider(),
- new Object[0]);
- return b.booleanValue();
- } catch (Exception e) {
- firingSelectionFailedCount++;
- JspEditorPlugin.getPluginLog().logError(e);
- }
- return false;
+ private boolean isFiringSelection() {
+ if (getSelectionProvider() == null)
+ return false;
+ if (firingSelectionFailedCount > 0)
+ return false;
+ try {
+ if (m == null) {
+ Class c = getSelectionProvider().getClass();
+ m = c.getDeclaredMethod("isFiringSelection", new Class[0]);
+ m.setAccessible(true);
}
+ Boolean b = (Boolean) m.invoke(getSelectionProvider(),
+ new Object[0]);
+ return b.booleanValue();
+ } catch (Exception e) {
+ firingSelectionFailedCount++;
+ JspEditorPlugin.getPluginLog().logError(e);
+ }
+ return false;
}
+ }
- private void updateRangeIndication0(ISelection selection) {
- if (selection instanceof IStructuredSelection
- && !((IStructuredSelection) selection).isEmpty()) {
- Object[] objects = ((IStructuredSelection) selection).toArray();
- if (objects.length > 0) {
- int start = ((IndexedRegion) objects[0]).getStartOffset();
- int end = ((IndexedRegion) objects[objects.length - 1])
- .getEndOffset();
- getSourceViewer().setRangeIndication(start, end - start, false);
- } else {
- getSourceViewer().removeRangeIndication();
- }
- } else {
- if (selection instanceof ITextSelection) {
- getSourceViewer().setRangeIndication(
- ((ITextSelection) selection).getOffset(),
- ((ITextSelection) selection).getLength(), false);
- } else {
- getSourceViewer().removeRangeIndication();
- }
- }
+ private void updateRangeIndication0(ISelection selection) {
+ if (selection instanceof IStructuredSelection
+ && !((IStructuredSelection) selection).isEmpty()) {
+ Object[] objects = ((IStructuredSelection) selection).toArray();
+ if (objects.length > 0) {
+ int start = ((IndexedRegion) objects[0]).getStartOffset();
+ int end = ((IndexedRegion) objects[objects.length - 1])
+ .getEndOffset();
+ getSourceViewer().setRangeIndication(start, end - start, false);
+ } else {
+ getSourceViewer().removeRangeIndication();
+ }
+ } else {
+ if (selection instanceof ITextSelection) {
+ getSourceViewer().setRangeIndication(
+ ((ITextSelection) selection).getOffset(),
+ ((ITextSelection) selection).getLength(), false);
+ } else {
+ getSourceViewer().removeRangeIndication();
+ }
}
+ }
- protected IExtendedAction createExtendedAction(String actionID) {
- if (StructuredTextEditorActionConstants.ACTION_NAME_FORMAT_DOCUMENT
- .equals(actionID)
- || ITextEditorActionConstants.UNDO.equals(actionID)
- || ITextEditorActionConstants.REDO.equals(actionID)) {
- return new ExtendedFormatAction(this, actionID);
- }
- return null;
+ protected IExtendedAction createExtendedAction(String actionID) {
+ if (StructuredTextEditorActionConstants.ACTION_NAME_FORMAT_DOCUMENT
+ .equals(actionID)
+ || ITextEditorActionConstants.UNDO.equals(actionID)
+ || ITextEditorActionConstants.REDO.equals(actionID)) {
+ return new ExtendedFormatAction(this, actionID);
}
+ return null;
+ }
- protected void initializeEditor() {
- super.initializeEditor();
- getPreferenceStore();
+ protected void initializeEditor() {
+ super.initializeEditor();
+ getPreferenceStore();
+ }
+
+ public void dispose() {
+ // some things in the configuration need to clean
+ // up after themselves
+ if (dnd != null) {
+ dnd.setTextEditorDropProvider(null);
+ dnd = null;
}
+ textEditorDropProvider = null;
+ getSourceViewer().removeTextListener(this);
+ if (fOutlinePage != null) {
+ if (fOutlinePage instanceof ConfigurableContentOutlinePage
+ && fOutlinePageListener != null) {
+ ((ConfigurableContentOutlinePage) fOutlinePage)
+ .removeDoubleClickListener(fOutlinePageListener);
+ }
+ if (fOutlinePageListener != null) {
+ fOutlinePage
+ .removeSelectionChangedListener(fOutlinePageListener);
+ }
+ }
+ fOutlinePage = null;
+ fOutlinePageListener = null;
+ if (fOccurrenceModelUpdater != null) {
+ fOccurrenceModelUpdater.uninstall();
+ fOccurrenceModelUpdater = null;
+ }
+ fPropertySheetPage = null;
+ if (pageContext != null) {
+ pageContext.dispose();
+ pageContext = null;
+ }
- public void dispose() {
- // some things in the configuration need to clean
- // up after themselves
- if (dnd != null) {
- dnd.setTextEditorDropProvider(null);
- dnd=null;
- }
- textEditorDropProvider=null;
- getSourceViewer().removeTextListener(this);
- if (fOutlinePage != null) {
- if (fOutlinePage instanceof ConfigurableContentOutlinePage && fOutlinePageListener != null) {
- ((ConfigurableContentOutlinePage) fOutlinePage).removeDoubleClickListener(fOutlinePageListener);
- }
- if (fOutlinePageListener != null) {
- fOutlinePage.removeSelectionChangedListener(fOutlinePageListener);
- }
- }
- fOutlinePage=null;
- fOutlinePageListener=null;
- if (fOccurrenceModelUpdater != null) {
- fOccurrenceModelUpdater.uninstall();
- fOccurrenceModelUpdater = null;
- }
- fPropertySheetPage = null;
- if (pageContext != null) {
- pageContext.dispose();
- pageContext = null;
- }
-
- if (wtpTextJspKbConnector != null) {
- wtpTextJspKbConnector.setTaglibManagerProvider(null);
- wtpTextJspKbConnector.dispose();
- wtpTextJspKbConnector = null;
- }
- super.dispose();
- if (listener != null)
- listener.dispose();
- listener = null;
- ISelectionProvider provider = getSelectionProvider();
- if (provider != null) {
- provider.removeSelectionChangedListener(getSelectionChangedListener());
- }
+ if (wtpTextJspKbConnector != null) {
+ wtpTextJspKbConnector.setTaglibManagerProvider(null);
+ wtpTextJspKbConnector.dispose();
+ wtpTextJspKbConnector = null;
}
+ super.dispose();
+ if (listener != null)
+ listener.dispose();
+ listener = null;
+ ISelectionProvider provider = getSelectionProvider();
+ if (provider != null) {
+ provider
+ .removeSelectionChangedListener(getSelectionChangedListener());
+ }
+ }
- BodyListenerImpl listener = null;
+ BodyListenerImpl listener = null;
- class BodyListenerImpl implements FileAnyImpl.BodyListener {
- FileAnyImpl file;
+ class BodyListenerImpl implements FileAnyImpl.BodyListener {
+ FileAnyImpl file;
- BodyListenerImpl(FileAnyImpl file) {
- this.file = file;
- file.addListener(this);
- }
+ BodyListenerImpl(FileAnyImpl file) {
+ this.file = file;
+ file.addListener(this);
+ }
- public void bodyChanged(String body) {
- setText(body);
- }
+ public void bodyChanged(String body) {
+ setText(body);
+ }
- public void dispose() {
- file.removeListener(this);
- }
+ public void dispose() {
+ file.removeListener(this);
}
+ }
- public void setText(String text) {
- if (getSourceViewer() == null
- || getSourceViewer().getDocument() == null)
- return;
- String txt = getSourceViewer().getDocument().get();
- if (txt != null && txt.length() > 0) {
- if (!TextMerge.replace(getSourceViewer().getDocument(), text)) {
- getSourceViewer().getDocument().set(text);
- }
- } else {
- getSourceViewer().getDocument().set(text);
- }
+ public void setText(String text) {
+ if (getSourceViewer() == null
+ || getSourceViewer().getDocument() == null)
+ return;
+ String txt = getSourceViewer().getDocument().get();
+ if (txt != null && txt.length() > 0) {
+ if (!TextMerge.replace(getSourceViewer().getDocument(), text)) {
+ getSourceViewer().getDocument().set(text);
+ }
+ } else {
+ getSourceViewer().getDocument().set(text);
}
+ }
- boolean isInsideResponseRedirect(Text textNode, int off) {
- if (off < 0)
- return false;
- String START = "response.sendRedirect(\"";
- String END = "\")";
- String text = textNode.getNodeValue();
- int i = 0;
- while (i < text.length() && i < off) {
- int i1 = text.indexOf(START, i);
- if (i1 < 0 || i1 + START.length() > off)
- return false;
- int i2 = text.indexOf(END, i1 + START.length());
- if (i2 < 0 || i2 >= off)
- return true;
- i = i2 + END.length();
- }
+ boolean isInsideResponseRedirect(Text textNode, int off) {
+ if (off < 0)
+ return false;
+ String START = "response.sendRedirect(\"";
+ String END = "\")";
+ String text = textNode.getNodeValue();
+ int i = 0;
+ while (i < text.length() && i < off) {
+ int i1 = text.indexOf(START, i);
+ if (i1 < 0 || i1 + START.length() > off)
return false;
+ int i2 = text.indexOf(END, i1 + START.length());
+ if (i2 < 0 || i2 >= off)
+ return true;
+ i = i2 + END.length();
}
-
- @Override
- public void editorContextMenuAboutToShow(IMenuManager menu) {
+ return false;
+ }
- super.editorContextMenuAboutToShow(menu);
+ @Override
+ public void editorContextMenuAboutToShow(IMenuManager menu) {
- /*
- * added by Dmitrovich Sergey JBIDE-1373 so as StructuredTextEditor
- * create context menu by hard code. The easiest way to add "show in"
- * menu is insert to prepared by
- * StructuredTextEditorStructuredTextEditor
- */
+ super.editorContextMenuAboutToShow(menu);
- MenuManager showInSubMenu = new MenuManager(getShowInMenuLabel());
- showInSubMenu.add(ContributionItemFactory.VIEWS_SHOW_IN
- .create(getEditorSite().getWorkbenchWindow()));
- menu.insertBefore(ITextEditorActionConstants.GROUP_COPY, new Separator(
- ITextEditorActionConstants.GROUP_SHOW_IN));
- menu.appendToGroup(ITextEditorActionConstants.GROUP_SHOW_IN,
- showInSubMenu);
+ /*
+ * added by Dmitrovich Sergey JBIDE-1373 so as StructuredTextEditor
+ * create context menu by hard code. The easiest way to add "show in"
+ * menu is insert to prepared by
+ * StructuredTextEditorStructuredTextEditor
+ */
- }
+ MenuManager showInSubMenu = new MenuManager(getShowInMenuLabel());
+ showInSubMenu.add(ContributionItemFactory.VIEWS_SHOW_IN
+ .create(getEditorSite().getWorkbenchWindow()));
+ menu.insertBefore(ITextEditorActionConstants.GROUP_COPY, new Separator(
+ ITextEditorActionConstants.GROUP_SHOW_IN));
+ menu.appendToGroup(ITextEditorActionConstants.GROUP_SHOW_IN,
+ showInSubMenu);
- private String getShowInMenuLabel() {
+ }
- return JSPEditorMessages.getString(SHOW_IN_MENU);
- }
+ private String getShowInMenuLabel() {
+
+ return JSPEditorMessages.getString(SHOW_IN_MENU);
+ }
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/dnd/VpeDnD.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/dnd/VpeDnD.java 2008-04-03 09:42:06 UTC (rev 7276)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/dnd/VpeDnD.java 2008-04-03 10:15:29 UTC (rev 7277)
@@ -32,6 +32,11 @@
*Class which response for drag and drop functionality
*/
public class VpeDnD {
+ /*
+ * Default transfer data
+ */
+ private static final String VPE_ELEMENT = ""; //$NON-NLS-1$
+
/**
* service manager */
private nsIServiceManager serviceManager;
@@ -79,7 +84,7 @@
nsISupportsString transferData = (nsISupportsString) getComponentManager()
.createInstanceByContractID(XPCOM.NS_SUPPORTSSTRING_CONTRACTID, null,
nsISupportsString.NS_ISUPPORTSSTRING_IID);
- String data="vpe-element"; //$NON-NLS-1$
+ String data=VPE_ELEMENT;
transferData.setData(data);
iTransferable.setTransferData(VpeController.MODEL_FLAVOR, transferData, data.length());
iTransferable.setTransferData("text/plain", transferData, data.length()); //$NON-NLS-1$
16 years, 11 months
JBoss Tools SVN: r7276 - in trunk/esb/plugins/org.jboss.tools.esb.core: resources/meta and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-04-03 05:42:06 -0400 (Thu, 03 Apr 2008)
New Revision: 7276
Added:
trunk/esb/plugins/org.jboss.tools.esb.core/images/esb/new_esb_file.gif
Modified:
trunk/esb/plugins/org.jboss.tools.esb.core/resources/meta/esb.meta
Log:
JBIDE-1988
Added: trunk/esb/plugins/org.jboss.tools.esb.core/images/esb/new_esb_file.gif
===================================================================
(Binary files differ)
Property changes on: trunk/esb/plugins/org.jboss.tools.esb.core/images/esb/new_esb_file.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/esb/plugins/org.jboss.tools.esb.core/resources/meta/esb.meta
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.core/resources/meta/esb.meta 2008-04-03 09:08:54 UTC (rev 7275)
+++ trunk/esb/plugins/org.jboss.tools.esb.core/resources/meta/esb.meta 2008-04-03 09:42:06 UTC (rev 7276)
@@ -20,7 +20,9 @@
<ICONS>
<GROUP name="action">
<GROUP name="new">
- <GROUP name="esb"/>
+ <GROUP name="esb">
+ <ICON name="file" path="plugin:org.jboss.tools.esb.core:images/esb/new_esb_file.gif"/>
+ </GROUP>
</GROUP>
</GROUP>
<GROUP name="main">
16 years, 11 months
JBoss Tools SVN: r7275 - trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/pages/jsf.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-04-03 05:08:54 -0400 (Thu, 03 Apr 2008)
New Revision: 7275
Added:
trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/pages/jsf/FaceletBlank.xhtml
trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/pages/jsf/FaceletCommon.xhtml
trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/pages/jsf/FaceletForm.xhtml
Log:
JBIDE-1831
Added: trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/pages/jsf/FaceletBlank.xhtml
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/pages/jsf/FaceletBlank.xhtml (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/pages/jsf/FaceletBlank.xhtml 2008-04-03 09:08:54 UTC (rev 7275)
@@ -0,0 +1,11 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html">
+
+ <ui:composition template="">
+
+ </ui:composition>
+
+</html>
\ No newline at end of file
Added: trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/pages/jsf/FaceletCommon.xhtml
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/pages/jsf/FaceletCommon.xhtml (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/pages/jsf/FaceletCommon.xhtml 2008-04-03 09:08:54 UTC (rev 7275)
@@ -0,0 +1,65 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core">
+
+ <f:loadBundle basename="resources" var="msg" />
+ <head>
+ <title><ui:insert name="pageTitle">Page Title</ui:insert></title>
+ <style type="text/css">
+ body {
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size: 14px;
+ }
+ .header {
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size: 18px;
+ }
+ .bottom {
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size: 9px;
+ text-align: center;
+ vertical-align: middle;
+ color: #8E969D;
+ }
+ </style>
+ </head>
+
+<body bgcolor="#ffffff">
+<table style="border:1px solid #CAD6E0" align="center" cellpadding="0" cellspacing="0" border="0" width="400">
+<tbody>
+
+ <tr>
+ <td class="header" height="42" align="center" valign="middle" width="100%" bgcolor="#E4EBEB">
+ <ui:insert name="pageHeader">Page Header</ui:insert>
+ </td>
+ </tr>
+ <tr>
+ <td height="1" width="100%" bgcolor="#CAD6E0"></td>
+ </tr>
+
+ <tr>
+ <td width="100%" colspan="2">
+ <table width="100%" style="height:150px" align="left" cellpadding="0" cellspacing="0" border="0">
+ <tbody>
+ <tr>
+ <td align="center" width="100%" valign="middle">
+
+ <ui:insert name="body">Page Body</ui:insert>
+
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="2" valign="bottom" height="1" width="100%" bgcolor="#CAD6E0"></td>
+ </tr>
+</tbody>
+</table>
+</body>
+
+</html>
\ No newline at end of file
Added: trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/pages/jsf/FaceletForm.xhtml
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/pages/jsf/FaceletForm.xhtml (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/pages/jsf/FaceletForm.xhtml 2008-04-03 09:08:54 UTC (rev 7275)
@@ -0,0 +1,21 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html">
+
+ <!--
+ Replace path to template, title, header and body
+ with actual data.
+ -->
+ <ui:composition template="/templates/common.xhtml">
+ <ui:define name="pageTitle">Title</ui:define>
+ <ui:define name="pageHeader">Header</ui:define>
+ <ui:define name="body">
+ <form jsfc="h:form" id="Form">
+
+ </form>
+ </ui:define>
+ </ui:composition>
+
+</html>
\ No newline at end of file
16 years, 11 months
JBoss Tools SVN: r7274 - trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-04-02 14:31:04 -0400 (Wed, 02 Apr 2008)
New Revision: 7274
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPKbImageFileResource.java
Log:
JBIDE-1985
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPKbImageFileResource.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPKbImageFileResource.java 2008-04-02 18:30:35 UTC (rev 7273)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPKbImageFileResource.java 2008-04-02 18:31:04 UTC (rev 7274)
@@ -269,7 +269,10 @@
}
boolean acceptExtension(String ext) {
- if(ext != null) ext = FilePathHelper.toPathPath(ext);
+ if(ext != null) {
+// ext = FilePathHelper.toPathPath(ext); What about UNIX?
+ ext = ext.toLowerCase();
+ }
return (extensions == null || extensions.contains(ext));
}
16 years, 11 months
JBoss Tools SVN: r7273 - trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/impl/trees.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-04-02 14:30:35 -0400 (Wed, 02 Apr 2008)
New Revision: 7273
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/impl/trees/FileSystemResourceTree.java
Log:
JBIDE-1985
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/impl/trees/FileSystemResourceTree.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/impl/trees/FileSystemResourceTree.java 2008-04-02 18:26:13 UTC (rev 7272)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/impl/trees/FileSystemResourceTree.java 2008-04-02 18:30:35 UTC (rev 7273)
@@ -119,7 +119,8 @@
if(type != XModelObject.FILE) return false;
String pathpart = o.getPathPart();
String pp = pathpart.substring(pathpart.lastIndexOf('.') + 1);
- pp = FilePathHelper.toPathPath(pp);
+// pp = FilePathHelper.toPathPath(pp); // What about UNIX?
+ pp = pp.toLowerCase();
String ent = o.getModelEntity().getName();
return (extensions == null || extensions.contains(pp)) &&
(entities == null || entities.contains(ent));
16 years, 11 months
JBoss Tools SVN: r7272 - trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/impl/trees.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-04-02 14:26:13 -0400 (Wed, 02 Apr 2008)
New Revision: 7272
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/impl/trees/FileSystemResourceTree.java
Log:
JBIDE-1985
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/impl/trees/FileSystemResourceTree.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/impl/trees/FileSystemResourceTree.java 2008-04-02 18:25:40 UTC (rev 7271)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/impl/trees/FileSystemResourceTree.java 2008-04-02 18:26:13 UTC (rev 7272)
@@ -14,6 +14,7 @@
import org.jboss.tools.common.model.*;
import org.jboss.tools.common.meta.*;
import org.jboss.tools.common.meta.constraint.*;
+import org.jboss.tools.common.model.filesystems.FilePathHelper;
import org.jboss.tools.common.model.filesystems.FileSystemsHelper;
import org.jboss.tools.common.model.filesystems.XFileObject;
import org.jboss.tools.common.model.util.XModelObjectLoaderUtil;
@@ -118,6 +119,7 @@
if(type != XModelObject.FILE) return false;
String pathpart = o.getPathPart();
String pp = pathpart.substring(pathpart.lastIndexOf('.') + 1);
+ pp = FilePathHelper.toPathPath(pp);
String ent = o.getModelEntity().getName();
return (extensions == null || extensions.contains(pp)) &&
(entities == null || entities.contains(ent));
16 years, 11 months
JBoss Tools SVN: r7271 - trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-04-02 14:25:40 -0400 (Wed, 02 Apr 2008)
New Revision: 7271
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPKbImageFileResource.java
Log:
JBIDE-1985
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPKbImageFileResource.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPKbImageFileResource.java 2008-04-02 16:22:17 UTC (rev 7270)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPKbImageFileResource.java 2008-04-02 18:25:40 UTC (rev 7271)
@@ -30,6 +30,7 @@
import org.jboss.tools.common.kb.KbDinamicResource;
import org.jboss.tools.common.kb.KbProposal;
import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.filesystems.FilePathHelper;
import org.jboss.tools.common.model.filesystems.FileSystemsHelper;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.jst.jsp.JspEditorPlugin;
@@ -268,6 +269,7 @@
}
boolean acceptExtension(String ext) {
+ if(ext != null) ext = FilePathHelper.toPathPath(ext);
return (extensions == null || extensions.contains(ext));
}
16 years, 11 months