Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Problem in opening an editor in a multipage editor from a table
Problem in opening an editor in a multipage editor from a table [message #508524] Tue, 19 January 2010 10:16 Go to next message
Rahul is currently offline RahulFriend
Messages: 13
Registered: July 2009
Location: India
Junior Member
I have a table which contains the EMF items and i try to open an editor in a multipage editor from the table.
this was working properly when i was in RCP plugin but the problem is coming after switching completely to EMF.

Below is the description of the problem

On clicking an element in Table Viewer , we have mapped an action delegate to it,
This action delegate calls the

IWorkbenchPage.openEditor(viewerInput, AgEditor.ID, activate);

wherein viewerInput is the IEditorInput and is set accordingly
AGEditor is the editor class which extends MultiPageEditorPart and implements IEditingDomainProvider, ISelectionProvider, IMenuListener, IViewerProvider, IGotoMarker

In the create pages method overwritten for the editor the Viewerpane is accessed by
ViewerPane viewerPane = new ViewerPane(getSite().getPage(), AgEditor.this)
However the viewerpane is got as null


Below is the code which i am using

public void createPages() {
// Creates the model from the editor input
//
createModel(); //This method is below

// Only creates the other pages if there is something that can be edited
//
if (!getEditingDomain().getResourceSet().getResources().isEmpty ())
{
// Create a page for the baseText view (like SpeechMarker).
//
{
if(getSite()!=null)
ViewerPane viewerPane = new ViewerPane(getSite().getPage(), AgEditor.this)
{
@Override
public Viewer createViewer(Composite parent)
{
return new BaseTextViewer(parent); // BaseTextViewer is one of the editor in MultiPageEditorPart
}

@Override
public void requestActivation() {
super.requestActivation();
((BaseTextViewer) getViewer()).setFocus();
setCurrentViewerPane(this);
}

/*
* (non-Javadoc)
* @see org.eclipse.emf.common.ui.ViewerPane#setFocus()
*/
@Override
public void setFocus()
{
requestActivation();
((BaseTextViewer) getViewer()).setFocus();
}
};

//Viewer Pane got here is null ... The AgEditor values is present





public void createModel() {
URI resourceURI = EditUIUtil.getURI(getEditorInput());
Exception exception = null;
Resource resource = null;
try {
// Load the resource through the editing domain.
//
resource = editingDomain.getResourceSet().getResource(resourceURI, true);
}
catch (Exception e) {
exception = e;
resource = editingDomain.getResourceSet().getResource(resourceURI, false);
}

Diagnostic diagnostic = analyzeResourceProblems(resource, exception);
if (diagnostic.getSeverity() != Diagnostic.OK) {
resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception));
}
editingDomain.getResourceSet().eAdapters().add(problemIndica tionAdapter);
}


If anyone can figure out the problem plaese provide a solution to this. I am using latest EMF v3.5. Any help provided will be deeply appreciated.

Thanks in advance
Rahul
Re: Problem in opening an editor in a multipage editor from a table [message #508606 is a reply to message #508524] Tue, 19 January 2010 15:38 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 30620
Registered: July 2009
Senior Member
Rahul,

Comments below.


Rahul wrote:
> I have a table which contains the EMF items and i try to open an
> editor in a multipage editor from the table.
> this was working properly when i was in RCP plugin but the problem is
> coming after switching completely to EMF.
>
> Below is the description of the problem
>
> On clicking an element in Table Viewer , we have mapped an action
> delegate to it,
> This action delegate calls the
> IWorkbenchPage.openEditor(viewerInput, AgEditor.ID, activate);
>
> wherein viewerInput is the IEditorInput and is set accordingly
> AGEditor is the editor class which extends MultiPageEditorPart and
> implements IEditingDomainProvider, ISelectionProvider, IMenuListener,
> IViewerProvider, IGotoMarker
> In the create pages method overwritten for the editor the
> Viewerpane is accessed by
> ViewerPane viewerPane = new ViewerPane(getSite().getPage(),
> AgEditor.this)
> However the viewerpane is got as null
>
> Below is the code which i am using
> public void createPages() {
> // Creates the model from the editor input
> //
> createModel(); //This method is below
>
> // Only creates the other pages if there is something that
> can be edited
> //
> if
> (!getEditingDomain().getResourceSet().getResources().isEmpty ())
> {
> // Create a page for the baseText view (like
> SpeechMarker).
> //
> {
> if(getSite()!=null)
> ViewerPane viewerPane = new
> ViewerPane(getSite().getPage(), AgEditor.this)
> {
> @Override
> public Viewer createViewer(Composite parent)
> {
> return new BaseTextViewer(parent);
> // BaseTextViewer is one of the editor in MultiPageEditorPart
> }
> @Override
> public void requestActivation() {
> super.requestActivation();
> ((BaseTextViewer)
> getViewer()).setFocus();
> setCurrentViewerPane(this);
> }
> /*
> * (non-Javadoc)
> * @see
> org.eclipse.emf.common.ui.ViewerPane#setFocus()
> */
> @Override
> public void setFocus()
> {
> requestActivation();
> ((BaseTextViewer)
> getViewer()).setFocus();
> }
> };
>
> //Viewer Pane got here is null ... The AgEditor values is present
>
>
>
>
>
> public void createModel() {
> URI resourceURI = EditUIUtil.getURI(getEditorInput());
> Exception exception = null;
> Resource resource = null;
> try {
> // Load the resource through the editing domain.
> //
> resource =
> editingDomain.getResourceSet().getResource(resourceURI, true);
> }
> catch (Exception e) {
> exception = e;
> resource =
> editingDomain.getResourceSet().getResource(resourceURI, false);
> }
>
> Diagnostic diagnostic = analyzeResourceProblems(resource,
> exception);
> if (diagnostic.getSeverity() != Diagnostic.OK) {
> resourceToDiagnosticMap.put(resource,
> analyzeResourceProblems(resource, exception));
> }
>
> editingDomain.getResourceSet().eAdapters().add(problemIndica
> tionAdapter);
> }
>
>
> If anyone can figure out the problem plaese provide a solution to
> this. I am using latest EMF v3.5. Any help provided will be deeply
> appreciated.
Best to use a debugger. I really can't see a problem just looking at
large code snippets.
>
> Thanks in advance
> Rahul
>
Previous Topic:Problems regarding the mapping of key bindings with the EMF Model
Next Topic:Utility to obtain model root
Goto Forum:
  


Current Time: Tue Nov 12 04:36:25 GMT 2019

Powered by FUDForum. Page generated in 0.01865 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top