Home » Modeling » Epsilon » custom marker view in an RCP app using evl(how to catch validation markers in a custom marker view?)
custom marker view in an RCP app using evl [message #536711] |
Sun, 30 May 2010 08:45 |
giampow Mising name Messages: 31 Registered: May 2010 |
Member |
|
|
Hi all,
I'm writing an RCP app based on EMF+GMF+EVL
and I'm successfully validating my model against the constraints I've written in the evl file.
Now I would like them to appear in the problems view, but it's not working: I've read that the problems view is not working with an RCP app.
So I'm trying to implement a custom marker view in order to catch such markers.
I've followed the instructions on http:// blog.eclipse-tips.com/2008/11/creating-custom-marker-view.ht ml
but can't get it work.
What's the type of markers generated by evl?
I thought it to be org.eclipse.emf.ecore.diagnostic.
In my plugin.xml of the diagram plugin used by my GMF app I've added the following code
<extension
point="org.eclipse.ui.views">
<view
class="org.eclipse.gmf.helpDesigner.helpDesigner.diagram.application.ProblemsView"
id="org.eclipse.gmf.helpDesigner.helpDesigner.views.ProblemsView"
name="Problems">
</view>
</extension>
<extension
point="org.eclipse.ui.ide.markerSupport">
<markerContentGenerator
id="org.eclipse.gmf.helpDesigner.problemsGenerator"
name="My Marker Generator">
<markerTypeReference id="org.eclipse.emf.ecore.diagnostic"/>
<markerFieldReference
id="org.eclipse.ui.ide.severityAndDescriptionField"/>
<markerFieldReference
id="org.eclipse.ui.ide.locationField"/>
<markerFieldReference
id="org.eclipse.ui.ide.markerType"/>
<markerFieldReference
id="org.eclipse.ui.ide.priorityField"/>
<markerFieldReference
id="org.eclipse.ui.ide.resourceField"/>
</markerContentGenerator>
</extension>
and the following class
package org.eclipse.gmf.helpDesigner.helpDesigner.diagram.application;
import org.eclipse.ui.views.markers.MarkerSupportView;
public class ProblemsView extends MarkerSupportView {
public ProblemsView() {
super("org.eclipse.gmf.helpDesigner.problemsGenerator");
}
}
does anybody have any tip?
It's really important to have a working marker view in my RCP app.
Thank you very much
[Updated on: Sun, 30 May 2010 08:59] Report message to a moderator
|
|
| | |
Re: custom marker view in an RCP app using evl [message #536717 is a reply to message #536714] |
Sun, 30 May 2010 09:18 |
Dimitrios Kolovos Messages: 1776 Registered: July 2009 |
Senior Member |
|
|
Hi,
I must admit I don't have much experience with EVL under RCP but I'd be
happy to have a look at your code if you could zip your project and send
it to me at dskolovos gmail com (or if you could grant me temporary
access to your CVS/SVN if you're using one).
Cheers,
Dimitris
giampow wrote:
> Hi Dimitris,
> thank you for your reply,
> I've tried to properly change the marker type according to what is
> defined in my validator plugin, but it's still not working.
>
> I've got different plugin.xml files (for the validator plugin, for the
> model, for the diagram....),
> maybe I need to put the view definition and the extension point for
> org.eclipse.ui.ide.markerSupport in another plugin.xml file?
>
> Thank you,
> I appreciate very much your work
|
|
|
Re: custom marker view in an RCP app using evl [message #536726 is a reply to message #536717] |
Sun, 30 May 2010 11:53 |
giampow Mising name Messages: 31 Registered: May 2010 |
Member |
|
|
Hi Dimitris,
I've sent to you my project by email.
I've tried to run it as a non RCP app, and in that case it works.
I mean, both the standard problems view and my custom marker view work.
Through the use of the debugger I've seen that, when running as RCP, the class org.eclipse.ui.internal.views.markers.MarkerContentGenerator
can't recognize my diagram specific marker type generated by GMF.
More precisely, in that class the following call results into a null pointer exception
MarkerTypesModel.getInstance().getType(elementName)
where is the id of my GMF specific marker.
If running as non RCP, this marker type is beeing recognized and the views work.
So I think the problem is something related to the eclipse architecture.
The following are markers "seen" by org.eclipse.ui.internal.views.markers.MarkerContentGenerator when running as RCP, where the GMF specific marker type is not included:
org.eclipse.gmf.runtime.common.ui.services.bookmark
org.eclipse.emf.validation.problem
org.eclipse.emf.ecore.diagnostic
org.eclipse.xsd.diagnostic
org.eclipse.core.resources.marker
org.eclipse.core.resources.bookmark
org.eclipse.debug.core.breakpointMarker
org.eclipse.core.resources.problemmarker
org.eclipse.core.resources.taskmarker
org.eclipse.gmf.runtime.common.ui.services.marker
org.eclipse.debug.core.lineBreakpointMarker
When running as a non RCP app, in the list appears more markers, among which my GMF generated one is present.
Its supertypes are:
org.eclipse.core.resources.problemmarker
org.eclipse.gmf.runtime.common.ui.services.marker
In my opinion this is a design flaw of RCP, since it should be possible to reuse in RCP the code written for a non RCP app, especially if it's a custom marker view.
Thank you
[Updated on: Sun, 30 May 2010 15:27] Report message to a moderator
|
|
|
Re: custom marker view in an RCP app using evl [message #536784 is a reply to message #536726] |
Sun, 30 May 2010 23:09 |
Dimitrios Kolovos Messages: 1776 Registered: July 2009 |
Senior Member |
|
|
Hi,
My (possibly wild) guess is that this happens because the marker view /
marker content generator mechanism, somehow assumes that there is a
workspace (which is true when you run your editor as a plugin but not
true when you run it as an RCP). I've been digging through the code to
see where this assumption is made and how it can be fixed with little
success. I'll have a look at this again tomorrow.
Cheers,
Dimitris
On 30/05/2010 12:54, giampow wrote:
> Hi Dimitris,
> I've sent to you my project by email.
>
> I've tried to run it as a non RCP app, and in that case it works.
> I mean, both the standard problems view and my custom marker view work.
>
> Through the use of the debugger I've seen that, when running as RCP, the
> class org.eclipse.ui.internal.views.markers.MarkerContentGenerator
> can't recognize my diagram specific marker type generated by GMF.
>
> If running as non RCP, this marker type is beeing recognized and the
> views work.
>
> So I think the problem is something related to the eclipse architecture.
>
> These are markers "seen" by
> org.eclipse.ui.internal.views.markers.MarkerContentGenerator when
> running as RCP, where the GMF specific marker type is not included:
>
> org.eclipse.gmf.runtime.common.ui.services.bookmark
> org.eclipse.emf.validation.problem
> org.eclipse.emf.ecore.diagnostic
> org.eclipse.xsd.diagnostic
> org.eclipse.core.resources.marker
> org.eclipse.core.resources.bookmark
> org.eclipse.debug.core.breakpointMarker
> org.eclipse.core.resources.problemmarker
> org.eclipse.core.resources.taskmarker
> org.eclipse.gmf.runtime.common.ui.services.marker
> org.eclipse.debug.core.lineBreakpointMarker
>
> In my opinion this is a design flaw, since it should be possible to
> reuse in RCP the code written for a non RCP app, especially if it's a
> custom marker view.
>
> Thank you
|
|
|
Re: custom marker view in an RCP app using evl [message #536786 is a reply to message #536784] |
Sun, 30 May 2010 23:39 |
Dimitrios Kolovos Messages: 1776 Registered: July 2009 |
Senior Member |
|
|
If my guess is valid then you'll need to implement a problems view from
scratch which will use a job to periodically iterate through all open
diagram editors and collect the error markers in each one of them.
Cheers,
Dimitris
On 31/05/2010 00:09, Dimitris Kolovos wrote:
> Hi,
>
> My (possibly wild) guess is that this happens because the marker view /
> marker content generator mechanism, somehow assumes that there is a
> workspace (which is true when you run your editor as a plugin but not
> true when you run it as an RCP). I've been digging through the code to
> see where this assumption is made and how it can be fixed with little
> success. I'll have a look at this again tomorrow.
>
> Cheers,
> Dimitris
>
> On 30/05/2010 12:54, giampow wrote:
>> Hi Dimitris,
>> I've sent to you my project by email.
>>
>> I've tried to run it as a non RCP app, and in that case it works.
>> I mean, both the standard problems view and my custom marker view work.
>>
>> Through the use of the debugger I've seen that, when running as RCP, the
>> class org.eclipse.ui.internal.views.markers.MarkerContentGenerator
>> can't recognize my diagram specific marker type generated by GMF.
>>
>> If running as non RCP, this marker type is beeing recognized and the
>> views work.
>>
>> So I think the problem is something related to the eclipse architecture.
>>
>> These are markers "seen" by
>> org.eclipse.ui.internal.views.markers.MarkerContentGenerator when
>> running as RCP, where the GMF specific marker type is not included:
>>
>> org.eclipse.gmf.runtime.common.ui.services.bookmark
>> org.eclipse.emf.validation.problem
>> org.eclipse.emf.ecore.diagnostic
>> org.eclipse.xsd.diagnostic
>> org.eclipse.core.resources.marker
>> org.eclipse.core.resources.bookmark
>> org.eclipse.debug.core.breakpointMarker
>> org.eclipse.core.resources.problemmarker
>> org.eclipse.core.resources.taskmarker
>> org.eclipse.gmf.runtime.common.ui.services.marker
>> org.eclipse.debug.core.lineBreakpointMarker
>>
>> In my opinion this is a design flaw, since it should be possible to
>> reuse in RCP the code written for a non RCP app, especially if it's a
>> custom marker view.
>>
>> Thank you
>
|
|
| | | | |
Re: custom marker view in an RCP app using evl [message #537677 is a reply to message #537632] |
Thu, 03 June 2010 11:06 |
Dimitrios Kolovos Messages: 1776 Registered: July 2009 |
Senior Member |
|
|
Hi Giampaolo,
giampow wrote:
> Hi Dimitris,
>
> I will try with a new View, but I'm quite new to development under
> Eclipse platform, so I don't know exactly how to show markers in a view.
>
> My markers are generated by the epsilon evl plugin and they are provided
> with a quick fix, too, I want to show their messages in a table and to
> have the user to click them to open the quick fix popup.
I suspect you can reuse (in the worst case via copy-paste) code from
ExtendedMarkersView. I'd also send an email to the platform/rcp/gmf
newsgroups to see if anyone there has done something similar that
they're willing to share.
>
> When I am finished, for sure I'll post my solution, in order to share it
> with others.
Looking forward to this!
>
> Thank you
> giampaolo
Cheers,
Dimitris
|
|
|
Re: custom marker view in an RCP app using evl [message #537864 is a reply to message #536711] |
Thu, 03 June 2010 21:59 |
giampow Mising name Messages: 31 Registered: May 2010 |
Member |
|
|
Hi Dimitris,
I've managed to implement a first working version of a custom problems view, written from scratch as a View using a TableViewer.
Here I'm posting my code,
now it works using a job which periodically refresh the marker list in the TableViewer component.
The next step, yet to be implemented, is to get a right-click context menu on each marker in the table, showing the "quick-fix" command.
Do you have any tip on how to show the quick-fix popup?
Thank you for the very valuable support
-----------
the view
package org.eclipse.gmf.helpDesigner.helpDesigner.diagram.part;
import java.util.List;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.TableViewerColumn;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Table;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.part.ViewPart;
public class ProblemsView extends ViewPart {
public static final String ID = "org.eclipse.gmf.helpDesigner.helpDesigner.diagram.part.ProblemsView";
public TableViewer viewer;
private UpdateJob updateJob;
public void createPartControl(Composite parent) {
createViewer(parent);
updateJob = new UpdateJob("updateMarkers");
IEditorPart editorPart = getSite().getPage().getActiveEditor();
updateJob.setEditorPart(editorPart);
updateJob.setProblemsView(this);
updateJob.schedule();
viewer.setInput(updateJob.getMarkerList());
}
private void createViewer(Composite parent) {
viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL
| SWT.V_SCROLL | SWT.FULL_SELECTION);
createColumns(viewer);
viewer.setContentProvider(new MarkerContentProvider());
viewer.setLabelProvider(new MarkerLabelProvider());
}
// This will create the columns for the table
private void createColumns(TableViewer viewer) {
String[] titles = { "Description", "Location", "Type" };
int[] bounds = { 100, 100, 100 };
for (int i = 0; i < titles.length; i++) {
TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE);
column.getColumn().setText(titles[i]);
column.getColumn().setWidth(bounds[i]);
column.getColumn().setResizable(true);
column.getColumn().setMoveable(true);
}
Table table = viewer.getTable();
table.setHeaderVisible(true);
table.setLinesVisible(true);
}
/**
* Passing the focus request to the viewer's control.
*/
public void setFocus() {
viewer.getControl().setFocus();
}
public static Display getDisplay() {
Display display = Display.getCurrent();
// may be null if outside the UI thread
if (display == null)
display = Display.getDefault();
return display;
}
public void clearMarkers() {
getDisplay().syncExec(new Runnable() {
public void run() {
while (viewer.getElementAt(0) != null) {
viewer.remove(viewer.getElementAt(0));
}
}
});
}
public void addMarkers(final List<ValidationMarker> markers) {
getDisplay().syncExec(new Runnable() {
public void run() {
viewer.add(markers.toArray());
}
});
}
}
which I've mapped in my plugin.xml of the diagram code generated by GMF with the following xml mapping
<extension
point="org.eclipse.ui.views">
<view
class="org.eclipse.gmf.helpDesigner.helpDesigner.diagram.part.ProblemsView"
id="org.eclipse.gmf.helpDesigner.helpDesigner.diagram.part.ProblemsView"
icon="icons\eview16\problems_view.gif"
name="Problems view">
</view>
</extension>
the job updating the markers
package org.eclipse.gmf.helpDesigner.helpDesigner.diagram.part;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.gef.EditPartViewer;
import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.ui.IEditorPart;
public class UpdateJob extends Job {
public UpdateJob(String name) {
super(name);
}
private List<ValidationMarker> markerList;
private IEditorPart editorPart;
private ProblemsView problemsView;
public List<ValidationMarker> getMarkerList() {
return markerList;
}
public void setEditorPart(IEditorPart editorPart) {
this.editorPart = editorPart;
}
public void setProblemsView(ProblemsView problemsView) {
this.problemsView = problemsView;
}
protected IStatus run(IProgressMonitor monitor) {
try {
if (editorPart instanceof IDiagramWorkbenchPart) {
final IDiagramWorkbenchPart part = (IDiagramWorkbenchPart) editorPart;
int severity = IStatus.INFO;
EditPartViewer viewer = part.getDiagramEditPart().getViewer();
View view = part.getDiagram();
if (view == null) {
return Status.CANCEL_STATUS;
}
problemsView.clearMarkers();
for (Iterator it = view.eAllContents(); it.hasNext();) {
EObject next = (EObject) it.next();
if (next instanceof View) {
ValidationMarker[] markers = ValidationMarker
.getMarkers(viewer, ViewUtil
.getIdStr((View) next));
if (markers != null && markers.length > 0) {
markerList = new ArrayList<ValidationMarker>();
for (int i = 0; i < markers.length; i++) {
markerList.add(markers[i]);
}
problemsView.addMarkers(markerList);
}
}
}
}
return Status.OK_STATUS;
} finally {
schedule(2000); //runs every 2 seconds
}
}
}
a couple of classes responsible for drawing marker properties in the table
package org.eclipse.gmf.helpDesigner.helpDesigner.diagram.part;
import java.util.List;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.Viewer;
public class MarkerContentProvider implements IStructuredContentProvider {
@Override
public Object[] getElements(Object inputElement) {
@SuppressWarnings("unchecked")
List<ValidationMarker> markers = (List<ValidationMarker>) inputElement;
return markers.toArray();
}
@Override
public void dispose() {
}
@Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
}
package org.eclipse.gmf.helpDesigner.helpDesigner.diagram.part;
import org.eclipse.emf.common.util.Diagnostic;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;
public class MarkerLabelProvider extends LabelProvider implements
ITableLabelProvider {
private static final Image ERROR = HelpDesignerDiagramEditorPlugin
.getBundledImageDescriptor("icons/obj16/error_tsk.gif")
.createImage();
@Override
public String getColumnText(Object element, int columnIndex) {
ValidationMarker marker = (ValidationMarker) element;
switch (columnIndex) {
case 0:
return marker.getMessage();
case 1:
return marker.getLocation();
case 2:
switch (marker.getStatusSeverity()) {
case Diagnostic.OK:
return "OK";
case Diagnostic.INFO:
return "Info";
case Diagnostic.WARNING:
return "Warning";
case Diagnostic.ERROR:
return "Error";
default:
throw new RuntimeException("Should not happen");
}
default:
throw new RuntimeException("Should not happen");
}
}
@Override
public Image getColumnImage(Object element, int columnIndex) {
if (columnIndex == 0) {
switch (((ValidationMarker) element).getStatusSeverity()) {
case Diagnostic.ERROR:
return ERROR;
}
}
return null;
}
}
[Updated on: Thu, 03 June 2010 22:02] Report message to a moderator
|
|
|
Re: custom marker view in an RCP app us ing evl [message #537877 is a reply to message #537864] |
Fri, 04 June 2010 01:51 |
Dimitrios Kolovos Messages: 1776 Registered: July 2009 |
Senior Member |
|
|
Hi Giampaolo,
Many thanks for sharing your solution! Regarding quick-fixes, I'd use
the plugin spy (http://www.eclipse.org/pde/incubator/spy/) to find the
class of the popup window and take it from there.
Cheers,
Dimitris
giampow <giampow@gmail.com> wrote:
> Hi Dimitris,
> I've managed to implement a first working version of a custom problems
> view, written from scratch as a View using a TableViewer.
>
> Here I'm posting my code,
> now it works using a job which periodically refresh the marker list in
> the TableViewer component.
>
> The next step, yet to be implemented, is to get a right-click context
> menu on each marker in the table, showing the "quick-fix" command.
>
> Do you have any tip on how to show the quick-fix popup?
>
> Thank you for the very valuable support
>
>
> package org.eclipse.gmf.helpDesigner.helpDesigner.diagram.part;
>
> import java.util.List;
>
> import org.eclipse.jface.viewers.TableViewer;
> import org.eclipse.jface.viewers.TableViewerColumn;
> import org.eclipse.swt.SWT;
> import org.eclipse.swt.widgets.Composite;
> import org.eclipse.swt.widgets.Display;
> import org.eclipse.swt.widgets.Table;
> import org.eclipse.ui.IEditorPart;
> import org.eclipse.ui.part.ViewPart;
>
> public class ProblemsView extends ViewPart {
> public static final String ID =
> " org.eclipse.gmf.helpDesigner.helpDesigner.diagram.part.Probl emsView ";
>
> public TableViewer viewer;
> private UpdateJob updateJob;
>
> public void createPartControl(Composite parent) {
> createViewer(parent);
> updateJob = new UpdateJob("updateMarkers");
> IEditorPart editorPart = getSite().getPage().getActiveEditor();
> updateJob.setEditorPart(editorPart);
> updateJob.setProblemsView(this);
> updateJob.schedule();
> viewer.setInput(updateJob.getMarkerList());
> }
>
> private void createViewer(Composite parent) {
> viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL
> | SWT.V_SCROLL | SWT.FULL_SELECTION);
> createColumns(viewer);
> viewer.setContentProvider(new MarkerContentProvider());
> viewer.setLabelProvider(new MarkerLabelProvider());
> }
>
> // This will create the columns for the table
> private void createColumns(TableViewer viewer) {
>
> String[] titles = { "Description", "Location", "Type" };
> int[] bounds = { 100, 100, 100 };
>
> for (int i = 0; i < titles.length; i++) {
> TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE);
> column.getColumn().setText(titles[i]);
> column.getColumn().setWidth(bounds[i]);
> column.getColumn().setResizable(true);
> column.getColumn().setMoveable(true);
> }
> Table table = viewer.getTable();
> table.setHeaderVisible(true);
> table.setLinesVisible(true);
> }
>
> /**
> * Passing the focus request to the viewer's control.
> */
> public void setFocus() {
> viewer.getControl().setFocus();
> }
>
> public static Display getDisplay() {
> Display display = Display.getCurrent();
> // may be null if outside the UI thread
> if (display == null)
> display = Display.getDefault();
> return display;
> }
>
> public void clearMarkers() {
> getDisplay().syncExec(new Runnable() {
> public void run() {
> while (viewer.getElementAt(0) != null) {
> viewer.remove(viewer.getElementAt(0));
> }
> }
> });
> }
>
> public void addMarkers(final List<ValidationMarker> markers) {
> getDisplay().syncExec(new Runnable() {
> public void run() {
> viewer.add(markers.toArray());
> }
> });
> }
> }
>
>
> which I've mapped in my plugin.xml of the diagram code generated by
> GMF with the following xml mapping
>
>
> <extension
> point="org.eclipse.ui.views">
> <view
>
> class=" org.eclipse.gmf.helpDesigner.helpDesigner.diagram.part.Probl emsView "
>
> id=" org.eclipse.gmf.helpDesigner.helpDesigner.diagram.part.Probl emsView "
> icon="icons\eview16\problems_view.gif"
> name="Problems view">
> </view>
> </extension>
>
>
> the job updating the markers
>
> package org.eclipse.gmf.helpDesigner.helpDesigner.diagram.part;
>
> import java.util.ArrayList;
> import java.util.Iterator;
> import java.util.List;
> import org.eclipse.core.runtime.IProgressMonitor;
> import org.eclipse.core.runtime.IStatus;
> import org.eclipse.core.runtime.Status;
> import org.eclipse.core.runtime.jobs.Job;
> import org.eclipse.emf.ecore.EObject;
> import org.eclipse.gef.EditPartViewer;
> import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
> import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPa rt;
> import org.eclipse.gmf.runtime.notation.View;
> import org.eclipse.ui.IEditorPart;
>
> public class UpdateJob extends Job {
>
> public UpdateJob(String name) {
> super(name);
> }
>
> private List<ValidationMarker> markerList;
> private IEditorPart editorPart;
> private ProblemsView problemsView;
>
> public List<ValidationMarker> getMarkerList() {
> return markerList;
> }
>
> public void setEditorPart(IEditorPart editorPart) {
> this.editorPart = editorPart;
> }
>
> public void setProblemsView(ProblemsView problemsView) {
> this.problemsView = problemsView;
> }
>
> protected IStatus run(IProgressMonitor monitor) {
> try {
> if (editorPart instanceof IDiagramWorkbenchPart) {
> final IDiagramWorkbenchPart part = (IDiagramWorkbenchPart)
> editorPart;
>
> int severity = IStatus.INFO;
>
> EditPartViewer viewer = part.getDiagramEditPart().getViewer();
>
> View view = part.getDiagram();
>
> if (view == null) {
> return Status.CANCEL_STATUS;
> }
>
> problemsView.clearMarkers();
>
> for (Iterator it = view.eAllContents(); it.hasNext();) {
> EObject next = (EObject) it.next();
> if (next instanceof View) {
> ValidationMarker[] markers = ValidationMarker
> .getMarkers(viewer, ViewUtil
> .getIdStr((View) next));
>
> if (markers != null && markers.length > 0) {
> markerList = new ArrayList<ValidationMarker>();
> for (int i = 0; i < markers.length; i++) {
> markerList.add(markers[i]);
> }
> problemsView.addMarkers(markerList);
> }
>
> }
> }
> }
> return Status.OK_STATUS;
> } finally {
> schedule(2000); //runs every 2 seconds
> }
> }
> }
>
>
> a couple of classes responsible for drawing marker properties in the
> table
>
> package org.eclipse.gmf.helpDesigner.helpDesigner.diagram.part;
>
> import java.util.List;
>
> import org.eclipse.jface.viewers.IStructuredContentProvider;
> import org.eclipse.jface.viewers.Viewer;
>
> public class MarkerContentProvider implements
> IStructuredContentProvider {
>
> @Override
> public Object[] getElements(Object inputElement) {
> @SuppressWarnings("unchecked")
> List<ValidationMarker> markers = (List<ValidationMarker>)
> inputElement;
> return markers.toArray();
> }
>
> @Override
> public void dispose() {
> }
>
> @Override
> public void inputChanged(Viewer viewer, Object oldInput, Object
> newInput) {
> }
>
> }
>
>
>
> package org.eclipse.gmf.helpDesigner.helpDesigner.diagram.part;
>
> import org.eclipse.emf.common.util.Diagnostic;
> import org.eclipse.jface.viewers.ITableLabelProvider;
> import org.eclipse.jface.viewers.LabelProvider;
> import org.eclipse.swt.graphics.Image;
>
> public class MarkerLabelProvider extends LabelProvider implements
> ITableLabelProvider {
>
> private static final Image ERROR = HelpDesignerDiagramEditorPlugin
> .getBundledImageDescriptor("icons/obj16/error_tsk.gif")
> .createImage();
>
> @Override
> public String getColumnText(Object element, int columnIndex) {
> ValidationMarker marker = (ValidationMarker) element;
> switch (columnIndex) {
> case 0:
> return marker.getMessage();
> case 1:
> return marker.getLocation();
> case 2:
> switch (marker.getStatusSeverity()) {
> case Diagnostic.OK:
> return "OK";
> case Diagnostic.INFO:
> return "Info";
> case Diagnostic.WARNING:
> return "Warning";
> case Diagnostic.ERROR:
> return "Error";
> default:
> throw new RuntimeException("Should not happen");
> }
> default:
> throw new RuntimeException("Should not happen");
> }
>
> }
>
> @Override
> public Image getColumnImage(Object element, int columnIndex) {
> if (columnIndex == 0) {
> switch (((ValidationMarker) element).getStatusSeverity()) {
> case Diagnostic.ERROR:
> return ERROR;
> }
> }
> return null;
> }
>
> }
>
>
>
> package org.eclipse.gmf.helpDesigner.helpDesigner.diagram.part;
>
> import java.util.List;
>
> import org.eclipse.jface.viewers.IStructuredContentProvider;
> import org.eclipse.jface.viewers.Viewer;
>
> public class MarkerContentProvider implements
> IStructuredContentProvider {
>
> @Override
> public Object[] getElements(Object inputElement) {
> @SuppressWarnings("unchecked")
> List<ValidationMarker> markers = (List<ValidationMarker>)
> inputElement;
> return markers.toArray();
> }
>
> @Override
> public void dispose() {
> }
>
> @Override
> public void inputChanged(Viewer viewer, Object oldInput, Object
> newInput) {
> }
>
> }
>
>
|
|
| | |
Re: custom marker view in an RCP app using evl [message #589527 is a reply to message #589523] |
Sun, 30 May 2010 09:18 |
Dimitrios Kolovos Messages: 1776 Registered: July 2009 |
Senior Member |
|
|
Hi,
I must admit I don't have much experience with EVL under RCP but I'd be
happy to have a look at your code if you could zip your project and send
it to me at dskolovos gmail com (or if you could grant me temporary
access to your CVS/SVN if you're using one).
Cheers,
Dimitris
giampow wrote:
> Hi Dimitris,
> thank you for your reply,
> I've tried to properly change the marker type according to what is
> defined in my validator plugin, but it's still not working.
>
> I've got different plugin.xml files (for the validator plugin, for the
> model, for the diagram....),
> maybe I need to put the view definition and the extension point for
> org.eclipse.ui.ide.markerSupport in another plugin.xml file?
>
> Thank you,
> I appreciate very much your work
|
|
|
Re: custom marker view in an RCP app using evl [message #589533 is a reply to message #536717] |
Sun, 30 May 2010 11:54 |
giampow Mising name Messages: 31 Registered: May 2010 |
Member |
|
|
Hi Dimitris,
I've sent to you my project by email.
I've tried to run it as a non RCP app, and in that case it works.
I mean, both the standard problems view and my custom marker view work.
Through the use of the debugger I've seen that, when running as RCP, the class org.eclipse.ui.internal.views.markers.MarkerContentGenerator
can't recognize my diagram specific marker type generated by GMF.
If running as non RCP, this marker type is beeing recognized and the views work.
So I think the problem is something related to the eclipse architecture.
These are markers "seen" by org.eclipse.ui.internal.views.markers.MarkerContentGenerator when running as RCP, where the GMF specific marker type is not included:
org.eclipse.gmf.runtime.common.ui.services.bookmark
org.eclipse.emf.validation.problem
org.eclipse.emf.ecore.diagnostic
org.eclipse.xsd.diagnostic
org.eclipse.core.resources.marker
org.eclipse.core.resources.bookmark
org.eclipse.debug.core.breakpointMarker
org.eclipse.core.resources.problemmarker
org.eclipse.core.resources.taskmarker
org.eclipse.gmf.runtime.common.ui.services.marker
org.eclipse.debug.core.lineBreakpointMarker
In my opinion this is a design flaw, since it should be possible to reuse in RCP the code written for a non RCP app, especially if it's a custom marker view.
Thank you
|
|
|
Re: custom marker view in an RCP app using evl [message #589567 is a reply to message #589533] |
Sun, 30 May 2010 23:09 |
Dimitrios Kolovos Messages: 1776 Registered: July 2009 |
Senior Member |
|
|
Hi,
My (possibly wild) guess is that this happens because the marker view /
marker content generator mechanism, somehow assumes that there is a
workspace (which is true when you run your editor as a plugin but not
true when you run it as an RCP). I've been digging through the code to
see where this assumption is made and how it can be fixed with little
success. I'll have a look at this again tomorrow.
Cheers,
Dimitris
On 30/05/2010 12:54, giampow wrote:
> Hi Dimitris,
> I've sent to you my project by email.
>
> I've tried to run it as a non RCP app, and in that case it works.
> I mean, both the standard problems view and my custom marker view work.
>
> Through the use of the debugger I've seen that, when running as RCP, the
> class org.eclipse.ui.internal.views.markers.MarkerContentGenerator
> can't recognize my diagram specific marker type generated by GMF.
>
> If running as non RCP, this marker type is beeing recognized and the
> views work.
>
> So I think the problem is something related to the eclipse architecture.
>
> These are markers "seen" by
> org.eclipse.ui.internal.views.markers.MarkerContentGenerator when
> running as RCP, where the GMF specific marker type is not included:
>
> org.eclipse.gmf.runtime.common.ui.services.bookmark
> org.eclipse.emf.validation.problem
> org.eclipse.emf.ecore.diagnostic
> org.eclipse.xsd.diagnostic
> org.eclipse.core.resources.marker
> org.eclipse.core.resources.bookmark
> org.eclipse.debug.core.breakpointMarker
> org.eclipse.core.resources.problemmarker
> org.eclipse.core.resources.taskmarker
> org.eclipse.gmf.runtime.common.ui.services.marker
> org.eclipse.debug.core.lineBreakpointMarker
>
> In my opinion this is a design flaw, since it should be possible to
> reuse in RCP the code written for a non RCP app, especially if it's a
> custom marker view.
>
> Thank you
|
|
|
Re: custom marker view in an RCP app using evl [message #589576 is a reply to message #536784] |
Sun, 30 May 2010 23:39 |
Dimitrios Kolovos Messages: 1776 Registered: July 2009 |
Senior Member |
|
|
If my guess is valid then you'll need to implement a problems view from
scratch which will use a job to periodically iterate through all open
diagram editors and collect the error markers in each one of them.
Cheers,
Dimitris
On 31/05/2010 00:09, Dimitris Kolovos wrote:
> Hi,
>
> My (possibly wild) guess is that this happens because the marker view /
> marker content generator mechanism, somehow assumes that there is a
> workspace (which is true when you run your editor as a plugin but not
> true when you run it as an RCP). I've been digging through the code to
> see where this assumption is made and how it can be fixed with little
> success. I'll have a look at this again tomorrow.
>
> Cheers,
> Dimitris
>
> On 30/05/2010 12:54, giampow wrote:
>> Hi Dimitris,
>> I've sent to you my project by email.
>>
>> I've tried to run it as a non RCP app, and in that case it works.
>> I mean, both the standard problems view and my custom marker view work.
>>
>> Through the use of the debugger I've seen that, when running as RCP, the
>> class org.eclipse.ui.internal.views.markers.MarkerContentGenerator
>> can't recognize my diagram specific marker type generated by GMF.
>>
>> If running as non RCP, this marker type is beeing recognized and the
>> views work.
>>
>> So I think the problem is something related to the eclipse architecture.
>>
>> These are markers "seen" by
>> org.eclipse.ui.internal.views.markers.MarkerContentGenerator when
>> running as RCP, where the GMF specific marker type is not included:
>>
>> org.eclipse.gmf.runtime.common.ui.services.bookmark
>> org.eclipse.emf.validation.problem
>> org.eclipse.emf.ecore.diagnostic
>> org.eclipse.xsd.diagnostic
>> org.eclipse.core.resources.marker
>> org.eclipse.core.resources.bookmark
>> org.eclipse.debug.core.breakpointMarker
>> org.eclipse.core.resources.problemmarker
>> org.eclipse.core.resources.taskmarker
>> org.eclipse.gmf.runtime.common.ui.services.marker
>> org.eclipse.debug.core.lineBreakpointMarker
>>
>> In my opinion this is a design flaw, since it should be possible to
>> reuse in RCP the code written for a non RCP app, especially if it's a
>> custom marker view.
>>
>> Thank you
>
|
|
| |
Re: custom marker view in an RCP app using evl [message #589782 is a reply to message #537632] |
Thu, 03 June 2010 11:06 |
Dimitrios Kolovos Messages: 1776 Registered: July 2009 |
Senior Member |
|
|
Hi Giampaolo,
giampow wrote:
> Hi Dimitris,
>
> I will try with a new View, but I'm quite new to development under
> Eclipse platform, so I don't know exactly how to show markers in a view.
>
> My markers are generated by the epsilon evl plugin and they are provided
> with a quick fix, too, I want to show their messages in a table and to
> have the user to click them to open the quick fix popup.
I suspect you can reuse (in the worst case via copy-paste) code from
ExtendedMarkersView. I'd also send an email to the platform/rcp/gmf
newsgroups to see if anyone there has done something similar that
they're willing to share.
>
> When I am finished, for sure I'll post my solution, in order to share it
> with others.
Looking forward to this!
>
> Thank you
> giampaolo
Cheers,
Dimitris
|
|
| | | | | | | | |
Goto Forum:
Current Time: Thu Sep 26 23:38:54 GMT 2024
Powered by FUDForum. Page generated in 0.06514 seconds
|