Class DialogMarkerProperties

All Implemented Interfaces:
IShellProvider
Direct Known Subclasses:
DialogTaskProperties

public class DialogMarkerProperties extends TrayDialog
Shows the properties of a new or existing marker In 3.3, this class was refactored to allow pre-existing public dialog classes to share the implementation. Note that certain methods are exposed as API in public subclasses, so changes to the methods in this class should be treated carefully as they may affect API methods in subclasses. The specific methods affected are documented in the method comment.
  • Constructor Details

    • DialogMarkerProperties

      public DialogMarkerProperties(Shell parentShell)
      Creates the dialog. By default this dialog creates a new marker. To set the resource and initial attributes for the new marker, use setResource and setInitialAttributes. To show or modify an existing marker, use setMarker.
      Parameters:
      parentShell - the parent shell
    • DialogMarkerProperties

      public DialogMarkerProperties(Shell parentShell, String title)
      Creates the dialog. By default this dialog creates a new marker. To set the resource and initial attributes for the new marker, use setResource and setInitialAttributes. To show or modify an existing marker, use setMarker.
      Parameters:
      parentShell - the parent shell
      title - the title of the dialog
    • DialogMarkerProperties

      public DialogMarkerProperties(Shell parentShell, String title, String markerName)
      Creates the dialog. By default this dialog creates a new marker. To set the resource and initial attributes for the new marker, use setResource and setInitialAttributes. To show or modify an existing marker, use setMarker.
      Parameters:
      parentShell - the parent shell
      title - the title of the dialog
      markerName - the name used to describe the specific kind of marker shown
      Since:
      3.3
  • Method Details

    • setMarker

      public void setMarker(IMarker marker)
      Sets the marker to show or modify.

      IMPORTANT: Although this class is internal, there are public subclasses that expose this method as API. Changes in this implementation should be treated as API changes.

      Parameters:
      marker - the marker, or null to create a new marker
      Since:
      3.3
    • getMarker

      protected IMarker getMarker()
      Returns the marker being created or modified. For a new marker, this returns null until the dialog returns, but is non-null after.

      IMPORTANT: Although this method is protected and the class is internal, there are public subclasses that expose this method as API. Changes in this implementation should be treated as API changes.

      Returns:
      the marker
      Since:
      3.3
    • setResource

      public void setResource(IResource resource)
      Sets the resource to use when creating a new task. If not set, the new task is created on the workspace root.

      IMPORTANT: Although this class is internal, there are public subclasses that expose this method as API. Changes in this implementation should be treated as API changes.

      Parameters:
      resource - the resource
    • getResource

      protected IResource getResource()
      Returns the resource to use when creating a new task, or null if none has been set. If not set, the new task is created on the workspace root.

      IMPORTANT: Although this method is protected and the class is internal, there are public subclasses that expose this method as API. Changes in this implementation should be treated as API changes.

      Returns:
      the resource
      Since:
      3.3
    • setInitialAttributes

      protected void setInitialAttributes(Map<String,Object> initialAttributes)
      Sets initial attributes to use when creating a new task. If not set, the new task is created with default attributes.

      IMPORTANT: Although this method is protected and the class is internal, there are public subclasses that expose this method as API. Changes in this implementation should be treated as API changes.

      Parameters:
      initialAttributes - the initial attributes
      Since:
      3.3
    • getInitialAttributes

      protected Map<String,Object> getInitialAttributes()
      Returns the initial attributes to use when creating a new task, or null if not set. If not set, the new task is created with default attributes.

      IMPORTANT: Although this method is protected and the class is internal, there are public subclasses that expose this method as API. Changes in this implementation should be treated as API changes.

      Returns:
      the initial attributes
      Since:
      3.3
    • configureShell

      protected void configureShell(Shell newShell)
      Method declared on Window.
      Overrides:
      configureShell in class Window
      Parameters:
      newShell - the shell
    • createDialogArea

      protected Control createDialogArea(Composite parent)
      Method declared on Dialog.
      Overrides:
      createDialogArea in class Dialog
      Parameters:
      parent - the parent composite to contain the dialog area
      Returns:
      the dialog area control
    • createSeperator

      protected void createSeperator(Composite parent)
      Creates a seperator.
    • createButtonsForButtonBar

      protected void createButtonsForButtonBar(Composite parent)
      Creates the OK and Cancel buttons.
      Overrides:
      createButtonsForButtonBar in class Dialog
      Parameters:
      parent - the button bar composite
    • createAttributesArea

      protected void createAttributesArea(Composite parent)
      This method is intended to be overridden by subclasses. The attributes area is created between the creation time area and the resource area.
      Parameters:
      parent - the parent composite
    • updateDialogFromMarker

      protected void updateDialogFromMarker()
      Updates the dialog from the marker state.
    • updateDialogForNewMarker

      protected void updateDialogForNewMarker()
      Updates the dialog from the predefined attributes.
    • okPressed

      protected void okPressed()
      Method declared on Dialog
      Overrides:
      okPressed in class Dialog
    • markDirty

      protected void markDirty()
      Sets the dialog's dirty flag to true
    • isDirty

      protected boolean isDirty()
      Returns:
      • true if the dirty flag has been set to true.
      • false otherwise.
    • getMarkerAttributes

      protected Map<String,Object> getMarkerAttributes()
      Returns the marker attributes to save back to the marker, based on the current dialog fields.
    • updateEnablement

      protected void updateEnablement()
      Updates widget enablement for the dialog. Should be overridden by subclasses.
    • isEditable

      protected boolean isEditable()
      Returns:
      • true if the marker is editable or the dialog is creating a new marker.
      • false if the marker is not editable.
    • setType

      protected void setType(String type)
      Sets the marker type when creating a new marker.
      Parameters:
      type - the marker type
      Since:
      3.3 this method is protected.
    • getDialogBoundsSettings

      protected IDialogSettings getDialogBoundsSettings()
      Description copied from class: Dialog
      Gets the dialog settings that should be used for remembering the bounds of of the dialog, according to the dialog bounds strategy.
      Overrides:
      getDialogBoundsSettings in class Dialog
      Returns:
      settings the dialog settings used to store the dialog's location and/or size, or null if the dialog's bounds should never be stored.
      See Also:
    • getModifyOperationTitle

      protected String getModifyOperationTitle()
      Return the string that describes a modify marker operation. Subclasses may override to more specifically describe the marker.
      Since:
      3.3
    • getCreateOperationTitle

      protected String getCreateOperationTitle()
      Return the string that describes a create marker operation. Subclasses may override to more specifically describe the marker.
      Since:
      3.3
    • isResizable

      protected boolean isResizable()
      Description copied from class: Dialog
      Returns a boolean indicating whether the dialog should be considered resizable when the shell style is initially set.

      This method is used to ensure that all style bits appropriate for resizable dialogs are added to the shell style. Individual dialogs may always set the shell style to ensure that a dialog is resizable, but using this method ensures that resizable dialogs will be created with the same set of style bits.

      Style bits will never be removed based on the return value of this method. For example, if a dialog returns false, but also sets a style bit for a SWT.RESIZE border, the style bit will be honored.

      Overrides:
      isResizable in class Dialog
      Returns:
      a boolean indicating whether the dialog is resizable and should have the default style bits for resizable dialogs