Class ModuleModelProvider

All Implemented Interfaces:
IAdaptable

public class ModuleModelProvider extends ModelProvider
The model provider of the IIZI Module projects: it is how iiziGo is asked before ANY Close Project of Eclipse closes a Module project (CC-FIX-UNSAVED-EVERY-CLOSE).

Every Close Project and Close Unrelated Projects of Eclipse is one class, CloseResourceAction: the Package Explorer's and the other Java views' (JDT makes its own), the Java editor's breadcrumb, a middle click on a project in the Project Explorer. iiziGo cannot stand in for those actions as it does in the IIZI Explorer (com.iizigo.navigator.CloseProjectActionProvider). But each of them asks Eclipse's change validation before it closes anything - CloseResourceAction.validateClose, in the SWT thread -, and the validation asks the model providers of the projects. So the question is asked here: the workbench's "Save Resources" prompt with every changed file of the Module projects that are about to be closed, with or without an editor (UnsavedFiles.askBeforeClose(IResource[])). Saved, or not saved by the user's choice, the close goes on. Canceled, the answer is a status that names the files: Eclipse then asks whether to continue, and No keeps the projects open.

A proposed close is told as a removal of the project that carries the flag OPEN; a Delete and a rename are not answered here (they have their participants, ModuleProjectDeleteParticipant and ModuleProjectRenameParticipant). A project that iiziGo's own Close Project has asked for in the same run is not asked for again.

Author:
Christopher Mindus
  • Field Details

  • Constructor Details

    • ModuleModelProvider

      public ModuleModelProvider()
  • Method Details

    • validateChange

      public IStatus validateChange(IResourceDelta delta, IProgressMonitor monitor)
      Validates a proposed change: for a close of Module projects that hold changed files, asks which files are saved.
      Overrides:
      validateChange in class ModelProvider
      Parameters:
      delta - The proposed change.
      monitor - The progress monitor.
      Returns:
      OK when nothing of a Module project would be lost or the user chose; otherwise a warning that names the changed files.