Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 191404 Details for
Bug 337289
[Xtext Editors] Papyrus textual embedded editors must migrate to XText 2.0
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch for org.eclipse.xtext.gmf.glue
org.eclipse.xtext.gmf.glue.patch (text/plain), 11.97 KB, created by
Arnaud Cuccuru
on 2011-03-17 07:47:55 EDT
(
hide
)
Description:
Patch for org.eclipse.xtext.gmf.glue
Filename:
MIME Type:
Creator:
Arnaud Cuccuru
Created:
2011-03-17 07:47:55 EDT
Size:
11.97 KB
patch
obsolete
>Index: src/org/eclipse/xtext/gmf/glue/concurrency/SimpleDirtyResource.java >=================================================================== >--- src/org/eclipse/xtext/gmf/glue/concurrency/SimpleDirtyResource.java (revision 4050) >+++ src/org/eclipse/xtext/gmf/glue/concurrency/SimpleDirtyResource.java (working copy) >@@ -40,9 +40,9 @@ > return resource.getSerializer().serialize(resource.getContents().get(0)); > } > >-// public String getActualContents() { >-// return resource.getSerializer().serialize(resource.getContents().get(0)); >-// } >+ public String getActualContents() { >+ return getContents(); >+ } > > public IResourceDescription getDescription() { > return resourceDescriptionManager.getResourceDescription(resource); >Index: src/org/eclipse/xtext/gmf/glue/edit/part/PopupXtextEditorKeyListener.java >=================================================================== >--- src/org/eclipse/xtext/gmf/glue/edit/part/PopupXtextEditorKeyListener.java (revision 4318) >+++ src/org/eclipse/xtext/gmf/glue/edit/part/PopupXtextEditorKeyListener.java (working copy) >@@ -38,20 +38,10 @@ > * @param popupXtextEditorHelper > * @param contentAssistant > */ >- public PopupXtextEditorKeyListener(PopupXtextEditorHelper popupXtextEditorHelper, ContentAssistantFacade contentAssistant) { >+ public PopupXtextEditorKeyListener(PopupXtextEditorHelper popupXtextEditorHelper, ContentAssistant contentAssistant) { > this.popupXtextEditorHelper = popupXtextEditorHelper; >- try { >- Field f = ContentAssistantFacade.class.getDeclaredField("fContentAssistant") ; >- f.setAccessible(true) ; >- this.contentAssistant = (ContentAssistant) f.get(contentAssistant) ; >- System.out.println() ; >- } >- catch (Exception exception) { >- System.out.println(exception) ; >- this.contentAssistant = null ; >- } >+ this.contentAssistant = contentAssistant; > isIgnoreNextESC = false; >- > } > > @Override >Index: src/org/eclipse/xtext/gmf/glue/edit/part/PopupXtextEditorHelper.java >=================================================================== >--- src/org/eclipse/xtext/gmf/glue/edit/part/PopupXtextEditorHelper.java (revision 4143) >+++ src/org/eclipse/xtext/gmf/glue/edit/part/PopupXtextEditorHelper.java (working copy) >@@ -11,6 +11,7 @@ > import java.util.List; > import java.util.Map; > >+import org.eclipse.core.commands.operations.DefaultOperationHistory; > import org.eclipse.core.commands.operations.IOperationHistory; > import org.eclipse.core.commands.operations.IUndoContext; > import org.eclipse.core.commands.operations.OperationHistoryFactory; >@@ -27,6 +28,7 @@ > import org.eclipse.jface.action.IAction; > import org.eclipse.jface.commands.ActionHandler; > import org.eclipse.jface.text.ITextOperationTarget; >+import org.eclipse.jface.text.contentassist.ContentAssistant; > import org.eclipse.jface.text.source.ISourceViewer; > import org.eclipse.jface.text.source.SourceViewer; > import org.eclipse.jface.text.templates.TemplateException; >@@ -58,6 +60,7 @@ > import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds; > import org.eclipse.ui.texteditor.IUpdate; > import org.eclipse.xtext.gmf.glue.Activator; >+import org.eclipse.xtext.gmf.glue.partialEditing.CustomXtextSourceViewer; > import org.eclipse.xtext.gmf.glue.partialEditing.ISyntheticResourceProvider; > import org.eclipse.xtext.gmf.glue.partialEditing.OperationHistoryListener; > import org.eclipse.xtext.gmf.glue.partialEditing.PartialModelEditor; >@@ -109,6 +112,7 @@ > private String semanticElementFragment; > private EObject semanticElement ; > private String textToEdit ; >+ > /** > * The file extension used to dynamically select the appropriate xtext editor > */ >@@ -290,9 +294,10 @@ > private void registerKeyListener() { > //XtextSourceViewer sourceViewer = (XtextSourceViewer) xtextEditor.getInternalSourceViewer(); > final StyledText xtextTextWidget = sourceViewerHandle.getViewer().getTextWidget(); >+ CustomXtextSourceViewer viewer = (CustomXtextSourceViewer)sourceViewerHandle.getViewer() ; > keyListener = > new PopupXtextEditorKeyListener >- (this, sourceViewerHandle.getViewer().getContentAssistantFacade()); >+ (this, (ContentAssistant) viewer.getContentAssistant()); > //keyListener.installUndoRedoSupport(sourceViewerHandle.getViewer()) ; > xtextTextWidget.addVerifyKeyListener(keyListener); > xtextTextWidget.addKeyListener(keyListener); >Index: src/org/eclipse/xtext/gmf/glue/partialEditing/SyntheticResourceProvider.java >=================================================================== >--- src/org/eclipse/xtext/gmf/glue/partialEditing/SyntheticResourceProvider.java (revision 4318) >+++ src/org/eclipse/xtext/gmf/glue/partialEditing/SyntheticResourceProvider.java (working copy) >@@ -14,9 +14,10 @@ > import org.eclipse.xtext.IGrammarAccess; > import org.eclipse.xtext.gmf.glue.edit.part.PopupXtextEditorHelper; > import org.eclipse.xtext.resource.XtextResource; >-import org.eclipse.xtext.ui.resource.IResourceSetProvider; >+import org.eclipse.xtext.resource.XtextResourceSet; > > import com.google.inject.Inject; >+import com.google.inject.Provider; > > /** > * @author Sebastian Zarnekow - Initial contribution and API >@@ -28,20 +29,28 @@ > */ > public static final String SYNTHETIC_SCHEME = "synthetic"; > >- @Inject >- private IResourceSetProvider resourceSetProvider; >+ //@Inject >+ //private IResourceSetProvider resourceSetProvider; >+ @Inject >+ private Provider<XtextResourceSet> resourceSetProvider; > > @Inject > private IGrammarAccess grammarAccess; > >+ >+ > public XtextResource createResource() { >- ResourceSet resourceSet = resourceSetProvider.get(null); >+ ResourceSet resourceSet = resourceSetProvider.get(); >+// EObject context = PopupXtextEditorHelper.context ; >+// ResourceSet resourceSet = context.eResource().getResourceSet() ; > Resource grammarResource = resourceSet.createResource( > URI.createURI(SYNTHETIC_SCHEME + ":/" + grammarAccess.getGrammar().getName() + ".xtext")); > grammarResource.getContents().add(EcoreUtil.copy(grammarAccess.getGrammar())); > XtextResource result = (XtextResource) resourceSet.createResource( > URI.createURI(SYNTHETIC_SCHEME + ":/" + grammarAccess.getGrammar().getName() + "." + PopupXtextEditorHelper.fileExtension)); > resourceSet.getResources().add(result); >- return result; >+ return result ; >+ > } >+ > } >Index: src/org/eclipse/xtext/gmf/glue/partialEditing/SourceViewerHandleFactory.java >=================================================================== >--- src/org/eclipse/xtext/gmf/glue/partialEditing/SourceViewerHandleFactory.java (revision 4318) >+++ src/org/eclipse/xtext/gmf/glue/partialEditing/SourceViewerHandleFactory.java (working copy) >@@ -11,8 +11,10 @@ > import java.util.List; > > import org.eclipse.core.runtime.IProgressMonitor; >+import org.eclipse.jface.text.source.IOverviewRuler; > import org.eclipse.jface.text.source.ISharedTextColors; > import org.eclipse.jface.text.source.IVerticalRuler; >+import org.eclipse.jface.text.source.OverviewRuler; > import org.eclipse.jface.text.source.VerticalRuler; > import org.eclipse.swt.SWT; > import org.eclipse.swt.events.DisposeEvent; >@@ -71,20 +73,17 @@ > * > */ > public SourceViewerHandle create(Composite parent, ISyntheticResourceProvider resourceProvider) { >+ /* >+ * final IVerticalRuler ruler = new VerticalRuler(VERTICAL_RULER_WIDTH, new DefaultMarkerAnnotationAccess()); >+ final IOverviewRuler oRuler = new OverviewRuler(new DefaultMarkerAnnotationAccess(), VERTICAL_RULER_WIDTH, getSharedColors()); >+ final XtextSourceViewer viewer = sourceViewerFactory.createSourceViewer(parent, ruler, oRuler, true, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); >+ */ >+ > //final XtextSourceViewer viewer= sourceViewerFactory.createSourceViewer(parent, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); > final IVerticalRuler ruler = new VerticalRuler(VERTICAL_RULER_WIDTH, null) ; >- final XtextSourceViewer viewer = sourceViewerFactory.createSourceViewer(parent, ruler, null, true, SWT.None); >+ //final XtextSourceViewer viewer = sourceViewerFactory.createSourceViewer(parent, ruler, null, true, SWT.None); >+ final XtextSourceViewer viewer = new CustomXtextSourceViewer(parent, ruler, null, true, SWT.None); > XtextSourceViewerConfiguration viewerConfiguration = sourceViewerConfigurationProvider.get(); >-// SourceViewerConfiguration configuration= new SourceViewerConfiguration() { >-// public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) { >-// >-// ContentAssistant assistant= new ContentAssistant(); >-// assistant.enableAutoActivation(true); >-// assistant.enableAutoInsert(true); >-// assistant.setContentAssistProcessor(fTemplateProcessor, IDocument.DEFAULT_CONTENT_TYPE); >-// return assistant; >-// } >-// }; > viewer.configure(viewerConfiguration); > > final SourceViewerDecorationSupport viewerDecorationSupport = new SourceViewerDecorationSupport(viewer, null, new DefaultMarkerAnnotationAccess(), getSharedColors()); >Index: src/org/eclipse/xtext/gmf/glue/partialEditing/CustomXtextSourceViewer.java >=================================================================== >--- src/org/eclipse/xtext/gmf/glue/partialEditing/CustomXtextSourceViewer.java (revision 0) >+++ src/org/eclipse/xtext/gmf/glue/partialEditing/CustomXtextSourceViewer.java (revision 0) >@@ -0,0 +1,63 @@ >+/***************************************************************************** >+ * Copyright (c) 2011 CEA LIST. >+ * >+ * >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * CEA LIST - Initial API and implementation >+ * >+ *****************************************************************************/ >+ >+package org.eclipse.xtext.gmf.glue.partialEditing; >+ >+import org.eclipse.jface.text.DocumentCommand; >+import org.eclipse.jface.text.contentassist.IContentAssistant; >+import org.eclipse.jface.text.source.IOverviewRuler; >+import org.eclipse.jface.text.source.IVerticalRuler; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.xtext.ui.editor.XtextSourceViewer; >+ >+/** >+ * This class extends XtextSourceViewer with the method getContentAssistant() >+ * This method was available on XtextSourceViewer in Xtext 1.0, and used >+ * for integration in Papyrus. >+ * >+ * @author CEA LIST - Initial contribution and API >+ */ >+public class CustomXtextSourceViewer extends XtextSourceViewer { >+ >+ /** >+ * @param parent >+ * @param ruler >+ * @param overviewRuler >+ * @param showsAnnotationOverview >+ * @param styles >+ * >+ */ >+ public CustomXtextSourceViewer(Composite parent, IVerticalRuler ruler, IOverviewRuler overviewRuler, >+ boolean showsAnnotationOverview, int styles) { >+ super(parent, ruler, overviewRuler, showsAnnotationOverview, styles); >+ } >+ >+ /** >+ * Used in papyrus integration for managing content assist in popup editors. >+ * @return the content assistant >+ * >+ */ >+ public IContentAssistant getContentAssistant() { >+ return fContentAssistant; >+ } >+ >+ @Override >+ protected void customizeDocumentCommand(DocumentCommand command) { >+ // TODO: TextViewer.customizeDocumentCommand generates exceptions. Why? >+ //super.customizeDocumentCommand(command); >+ } >+ >+ >+ >+} >Index: META-INF/MANIFEST.MF >=================================================================== >--- META-INF/MANIFEST.MF (revision 4318) >+++ META-INF/MANIFEST.MF (working copy) >@@ -18,10 +18,12 @@ > org.eclipse.uml2.uml;bundle-version="3.1.0", > org.eclipse.papyrus.sasheditor;bundle-version="0.8.0", > org.eclipse.papyrus.editor;bundle-version="0.8.0", >- org.eclipse.papyrus.core;bundle-version="0.8.0" >+ org.eclipse.papyrus.core;bundle-version="0.8.0", >+ org.eclipse.papyrus.properties.runtime;bundle-version="0.8.0" > Bundle-RequiredExecutionEnvironment: J2SE-1.5 > Bundle-ActivationPolicy: lazy > Export-Package: org.eclipse.xtext.gmf.glue, >+ org.eclipse.xtext.gmf.glue.concurrency, > org.eclipse.xtext.gmf.glue.contentassist, > org.eclipse.xtext.gmf.glue.edit.part, > org.eclipse.xtext.gmf.glue.editingdomain,
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
rschnekenburger
:
iplog+
Actions:
View
|
Diff
Attachments on
bug 337289
:
189077
|
189079
| 191404