I'm using Eclipse to work with several types of files such as Python, Javascript and PHP. When working on Python files I use the PyDev perspective and likewise for PHP I switch to the PHP perspective etc.
I find it uncomfortable that when switching from one perspective to another I still see all types of files open in the main work area.
I would prefer that when I switch to Python all non-Python files will be hidden away and only .py files will be shown. When switching to Javascript, I'd like to have any hidden (open) .js files visible and my open .py files hidden. Is this an existing feature in Eclipse or is this just something I'm expecting to see? :) How might one go about implementing this functionality?
You may switch perspectives by choosing Window, Open Perspective from the main menu, as shown below. Close the Welcome window and you will see the Eclipse user interface. The current perspective is displayed on the title bar.
To open multiple Eclipse windows using the same workspace, select Window→ New Window.
If you are interested in implementing the feature yourself, you can use the new API we introduced in 3.5. https://bugs.eclipse.org/bugs/show_bug.cgi?id=11001
Edit:
For example, here's a handler that hides the active editor, storing the reference in the plugin activator until it can be shown:
public class HideEditorHandler extends AbstractHandler {
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
IEditorPart activeEditor = HandlerUtil.getActiveEditorChecked(event);
IWorkbenchPage page = activeEditor.getSite().getPage();
IEditorReference reference = (IEditorReference) page
.getReference(activeEditor);
Activator.getDefault().getEditorManager().add(reference);
page.hideEditor(reference);
return null;
}
}
The only way you might combine different perspective with different set of file is by taking advantage of mylyn contexts.
A context can show you only the resources (and the editors) associated to a current task.
If, when you are switching of perspective, you also indicate a mylyn task, then you would restore your environment to what that task was referring to.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With