wiki:Grits_Classes_3_x_to_E4

Version 3 (modified by shan, 6 years ago) (diff)

--

Change in available classes and methods from core plugin

Classes (and their methods) that are not available

ProjectExplorerView

ProjectExplorerView class (org.grits.toolbox.core.projectexplorer.view.ProjectExplorerView) replaced with ProjectExplorerPart class (org.grits.toolbox.core.projectexplorer.part.ProjectExplorerPart)

Fixing your plugin

3.x plugins

method ProjectExplorerView.getClickedEntry() has no counterpart for 3.x plugins but a possible option would be to replace with HandlerUtil.getActiveMenuSelection(event) in case of commands using project explorer's current selection.

ProjectExplorerView.getClickedEntry() returned the last selected entry for the project explorer view , even if this view was not active. So far, e4 ProjectExplorerPart does not provide any such functionality but can be provided if needed. ProjectExplorerPart in e4 sets the current active selection as the selected entry(ies).

e4 plugins
  • should use ESelectionService (or @Named(IServiceConstants.ACTIVE_SELECTION)). Below is an example code
    	// example 1
    	@CanExecute
    	public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION) Object object)
    	{
    		return object instanceof Entry && ((Entry) object).getProperty().isRenamable();
    	}
    
    	// example 2
    	@CanExecute
    	public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION) Object object)
    	{
    		return object instanceof Entry || object instanceof StructuredSelection;
    	}
    
    

Note

  • When current selection is a single entry
    • selection is an object of type Entry (org.grits.toolbox.core.datamodel.Entry)
  • When current selection is a list of entries
    • selection is an object of type StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)

Deprecated Classes and methods

DataModelHandler

  • uses IGritsDataModelService internally

PropertyHandler

  • uses IGritsDataModelService internally
  • root workspace entry is also injected to appplication

EditorHandler

e4 plugins

  • should use IGritsUIService instead