wiki:Grits_Classes_3_x_to_E4

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)

Also see fixing perspective

Fixing your 3.x plugin

ProjectExplorerView.getClickedEntry() returned the last selected entry for the project explorer view , even if this view was not active.

  • Replace ProjectExplorerView.getClickedEntry() with using PropertyHandler.getDataModel().getLastSelection() and getting entry from it
    • returns a StructuredSelection which can be used to retrieve the last selected entry from the data model

Example code :

	if(selectedEntry == null
		&& PropertyHandler.getDataModel().getLastSelection() != null
		&& PropertyHandler.getDataModel().getLastSelection().getFirstElement() instanceof Entry)
	{
		selectedEntry = (Entry) PropertyHandler.getDataModel().getLastSelection().getFirstElement();
	}

Note : If you are using HandlerUtil.getActiveMenuSelection(event), try using HandlerUtil.getCurrentSelection(event) to get the selection. But the returned selection is a StructuredSelection type not a TreeSelection.

Example code :

	ISelection selection = HandlerUtil.getCurrentSelection(event);
	if(selection instanceof StructuredSelection
			&& ((StructuredSelection) selection).getFirstElement() instanceof Entry)
	{
		parentEntry = (Entry) ((StructuredSelection) selection).getFirstElement();
	}

Deprecated Classes and methods

DataModelHandler

  • uses IGritsDataModelService internally

PropertyHandler

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

EditorHandler

  • only for 3.x plugins
Last modified 5 years ago Last modified on 06/09/2016 05:16:37 PM