Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » How can I enable "Mark Occurrences" in a Java editor that is loaded in a multi page editor
How can I enable "Mark Occurrences" in a Java editor that is loaded in a multi page editor [message #646227] Wed, 22 December 2010 18:57
Florian is currently offline FlorianFriend
Messages: 1
Registered: December 2010
Junior Member
I am working on a multi page editor that opens multiple files (e.g. java, html) in separate tabs of a multi page editor. The files get opened with the default editors associated with the file type and these default editors are embedded in the multi page editor as tabs.

Here is how I am determining which editor to load (for a file type):

    void createPage()  throws PartInitException 
    {
        // get editor registry
        IEditorRegistry editorRegistry = Activator.getDefault().getWorkbench().getEditorRegistry();
	
        // loop through mappings until the extension matches.
        IEditorDescriptor editorDescriptor = editorRegistry.getDefaultEditor(((IFileEditorInput)getEditorInput()).getFile().getName());

        // if no editor was found that is associated to the file extension
        if (editorDescriptor == null) 
        {
		IEditorRegistry registry = Activator.getDefault().getWorkbench().getEditorRegistry();
		editorDescriptor = registry.findEditor(EditorsUI.DEFAULT_TEXT_EDITOR_ID); 
    	}
	
        IConfigurationElement configuration = ((EditorDescriptor) editorDescriptor).getConfigurationElement();
    
        String className = configuration.getAttribute("class");
	    

        IEditorPart editor;
        try 
        {
    	editor = (IEditorPart) WorkbenchPlugin.createExtension(configuration, "class");
   
        } catch (CoreException e) {
    	    throw new RuntimeException(e);
        }
	
	final int index = addPage(editor, getEditorInput());
	setPageText(index, "TAB_NAME");
    }



The multi tab editor gets created without any problems and the correct editors are loaded within the tabs.

But the 'Mark Occurrences' functionality is not working in the Java Editor when loaded in a tab.

I validated that mark occurrences is turned on. When I select a variable in the java editor in my multi page editor tab it does not highlight the other occurrences of the variable.
But if I open the file in my multi tab editor and in a separate java editor at the same time and select a variable in the separate java editor it will highlight the other occurrences in the separate java editor as well as the java editor that is embedded in my multi page editor.
So the functionality seems to be enabled and loaded, it just does not execute the mark occurrences functionality when the selecting happens in the embedded editor.

What needs to be changed so that I can use the mark occurrences functionality from within the java editor that is embedded in my multi tab editor?


My understanding is that Mark Occurences is a central service so I assume I am missing the part that updates this service when something gets selected in my editor. Any idea on what needs to be done so the service gets updated?
Previous Topic:Can Eclipse 64bit work with JDK/J2SE 32bit (on 64bit Win7)?
Next Topic:Databinding java.beans & org.eclipse.core.databinding
Goto Forum:
  


Current Time: Thu Mar 28 16:17:10 GMT 2024

Powered by FUDForum. Page generated in 0.02647 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top