wiki:Grits_Classes_3_x_to_E4

Version 2 (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() should be replaced with HandlerUtil.getActiveMenuSelection(event) in case of commands using project explorer's current selection

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