Hesham Eraqi
Hesham Eraqi

Reputation: 2542

Eclipse Plug-in Custom View Number of Markers

I've created a new Eclipse plug-in that installs a new View. After some operation I fill this View with Markers.

The View only shows the first 100 Markers as in the following image:

Eclipse Markers http://www.imageupload.co.uk/images/2014/02/27/Markers.png

How can I increase that 100 Markers limit ?

Here is how I implemented the View:

plugin.xml:

   <extension
         id="code_presentation.marker"
         name="Code Presentation Markers"
         point="org.eclipse.core.resources.markers">
      <persistent
            value="true">
      </persistent>
      <super
            type="org.eclipse.core.resources.textmarker">
      </super>
      <attribute
            name="owner">
      </attribute>
   </extension>
   <extension
         point="org.eclipse.ui.editors.annotationTypes">
      <type
            markerSeverity="0"
            markerType="code_presentation.marker"
            name="code_presentation.marker.type">

      </type>
   </extension>
  <extension
         point="org.eclipse.ui.editors.markerAnnotationSpecification">
      <specification
         annotationType="code_presentation.marker.type"
         colorPreferenceKey="code_presentation.marker.type.color"
         colorPreferenceValue="255,255,0"
         contributesToHeader="true"
         highlightPreferenceKey="code_presentation.marker.type.highlight"
         highlightPreferenceValue="false"
         includeOnPreferencePage="true"
         isGoToNextNavigationTargetKey="code_presentation.marker.type.nextnavigation"
         isGoToNextNavigationTarget="true"
         isGoToPreviousNavigationTargetKey="code_presentation.marker.type.previousnavigation"
         isGoToPreviousNavigationTarget = "true"
         icon="icons/Code_Presentation_Small.png"
         label="Qac error marker"
         overviewRulerPreferenceKey="code_presentation.marker.type.overview"
         overviewRulerPreferenceValue="true"
         presentationLayer="0"
         textPreferenceKey="code_presentation.marker.type.text"
         textPreferenceValue="false"
         textStylePreferenceValue="BOX"
         verticalRulerPreferenceKey="code_presentation.marker.type.ruler"
         verticalRulerPreferenceValue="true">
      </specification>
   </extension>
   <extension 
      point="org.eclipse.ui.views"> 
      <view 
         class="code_presentation.markersview.MyCustomMarkersView" 
         icon="icons/Code_Presentation_Small.png" 
         id="code_presentation.markersview.customMarker" 
         name="Code Presentation Markers"> 
      </view> 
   </extension>
   <extension 
      point="org.eclipse.ui.ide.markerSupport"> 
    <markerField 
      class="code_presentation.markersview.JustificationField" 
      id="code_presentation.markersview.Justificationfield" 
      name="Justification"> 
    </markerField>
    <markerContentGenerator 
      id="code_presentation.markersview.myCustomMarkerGenerator" 
      name="My Marker Generator"> 
       <markerTypeReference 
             id="code_presentation.marker"/>
       <markerFieldReference 
             id="org.eclipse.ui.ide.priorityField"/> 
       <markerFieldReference 
             id="org.eclipse.ui.ide.severityAndDescriptionField"/> 
       <markerFieldReference 
             id="org.eclipse.ui.ide.resourceField"/>
       <markerFieldReference 
             id="org.eclipse.ui.ide.locationField"/> 
       <markerFieldReference 
             id="code_presentation.markersview.justificationfield"/> 
    </markerContentGenerator>  
   </extension>

And I have three java files as in the following images:

First File Code. http://www.imageupload.co.uk/images/2014/02/27/Untitled1z3Sd6.png

Second File Code. http://www.imageupload.co.uk/images/2014/02/27/Untitled2.png

Third File Code. http://www.imageupload.co.uk/images/2014/02/27/Untitled3.png

Upvotes: 0

Views: 977

Answers (2)

Kohei Mikami
Kohei Mikami

Reputation: 2870

ExtendedMarkersView get the number of limit from PreferenceStore. You have to change the value.

If you disable the limit of MarkerView, write code as follows:

    IDEWorkbenchPlugin.getDefault().getPreferenceStore().setValue(
            IDEInternalPreferences.USE_MARKER_LIMITS, false);

If you change the limit of MarkerView, write code as follows:

    IDEWorkbenchPlugin.getDefault().getPreferenceStore()
            .setValue(IDEInternalPreferences.MARKER_LIMITS_VALUE, 200);

Attention:

When you change the value of PreferenceStore, all of the MarkerView's limit will be changed. If you don't want to change it, you have to override ExtendedMarkersView#getStatusMessage on your own.

EDIT:

Add org.eclipse.ui.ide package to required plugins in your plugin.xml before using IDEWorkbenchPlugin.

Add Required Plug-ins

Upvotes: 1

greg-449
greg-449

Reputation: 111142

The limit is set in org.eclipse.ui.internal.views.markers.MarkerContentGenerator but this is an internal class so cannot be accessed directly.

The only thing that sets the limit is org.eclipse.ui.internal.views.markers.FiltersConfigurationDialog which is also internal.

You can display this filters configuration dialog by adding a menu contribution for the command id org.eclipse.ui.ide.configureFilters.

This is the part of the Problems View plugin.xml menu definitions which links to the filters menu:

<extension
     point="org.eclipse.ui.menus">
   <menuContribution
        locationURI="menu:org.eclipse.ui.views.ProblemView">
     <command
           commandId="org.eclipse.ui.ide.configureFilters"
           mnemonic="%command.configureFilters.mnemonic"
           style="push">
     </command>
  </menuContribution>
</extension>

You should be able to do something similar for your view.

Upvotes: 3

Related Questions