I want to delete perspectives which I have created. But here I don't want to use Eclipse's own page. I want to create my own page and display list of Perspectives and give option to delete it or make it default. I don't want to use default Eclipse page because I don't need "Fast View" and other options for perspectives. That's why I decided to create my own page list only what I need. But I don't know how to get list of perspectives and methods to make it default and delete.
This the page which I am displaying right now in my application:
You use the IPerspectiveRegistry to manipulate the perspective registry:
IPerspectiveRegistry perspectiveRegistry = PlatformUI.getWorkbench().getPerspectiveRegistry();
You can get the list of perspectives from the registry with:
IPerspectiveDescriptor [] perspectives = perspectiveRegistry.getPerspectives();
You can delete a perspective by calling the registry method
public void deletePerspective(IPerspectiveDescriptor persp)
but note that the JavaDoc says:
Deletes a perspective. Has no effect if the perspective is defined in
an extension.
Related
Is it possible to define a perspective stack and perspective in the fragment.e4xmi?
The Eclipse 4 model editor doesn't seem to allow it. Why?
I add a new Model Fragment and for Feature Name I click Find ....
When I want to add a Perspective or a Perspective Stack, the dialog greys out the OK-Button.
Also, I have a lack of understanding what this Dialog is showing in general. It lists certain UI Elements and a lot of items below them, like
children
handlers
menus
and so on.
But those are listed multiple times. For example children is listed under CompositePart and under Dialog. But it doesn't make any difference which one I chose.
I know I can define the Perspective in the plugin.xml using the extension point and implementing IPerspectiveFactory. Is there no way to do it with the fragment.e4xmi?
Not sure about that dialog as I don't usually use it.
What you want to add is a Model Fragment with the 'Extended Element-ID' set to the id of the TrimmedWindow you want to put the perspective in. The 'Feature Name' would be children.
The model editor should then let you add a "Perspective Stack" as a child.
You can add the Perspective to the stack.
Note: Using the plugin.xml and IPerspectiveFactory is for Eclipse 3.x compatability mode, not pure e4. If you are using compatability mode I'm not sure how defining a perspective in the model editor fits.
I have a lot of projects in my package view with a lot of resources(.java, .xml, .vm, .js, and so on) but I work only with several of them and the list could change with the time. I need a tool that allow me to filter quickly only selected files("my files") and back to a full projects list. I thought I can do that using working sets but I can't find a way to add and delete files from an existing working set.
Go to Window->Customize Perspective. In Command And Groups Availability tab enable Window Working Set option if not enabled. Click OK
Go to Window->Working Sets->Edit. A dialog will pop up. Click Edit button after selecting any working set.
I'm developing an Eclipse plugin where the user can create perspectives from scratch. The user must enter a name for the perspective among other things and I need to check if the name already exists, so I need to read the information about the perspectives. I also need to add the perspective to the list programatically.
Do you know which class is related with the perspectives (not the UI)?
IPerspectiveRegistry perspectives = PlatformUI.getWorkbench ().getPerspectiveRegistry ();
if (perspectives.findPerspectiveWithLabel (name) != null){
//Error
}
I have an editor that extends TextEditor. This defaults to having access to Text Editor preferences which is set via "Editor > Text Editor" in the Preference dialog. But this also means call to that getPreferenceStore() will return the TextEditor preference store.
I don't mind this, except I would also like to have a second preference store with preferences specific to my editor.
How would I go about doing this without the 2 preferences conflicting each other?
Would I need to declare the second preference store locally to my Plugin/Activator class and override the getPreferenceStore() method locally?
If so, would EditorsPlugin.getDefault().getPreferenceStore() and MyEditorPlugin.getDefault().getPreferenceStore() return appropriate preferences?
Thanks!
I don't thinks there is any problem. You have your editor extend TextEditor,you use your MyEditorPlugin.getDefault().getPreferenceStore(), the two perfreence store are totally separated. You can create your own PropertyChangeListener to listen property change. In all, you can do everything you like because the two perference store are totally separated. You can you can handle your own perference using the standard listener mechanism.
Question about Eclipse RCP and whole perspective/view/editor design - what is the best way to create application which will display multiple windows on multiple monitors? Tutorials and book I've seen always pack RCP/SWT design into views inside perspective within single application window.
Should one window rule all others or they all should be equal (closing last one exits application)? How deal with the perspectives and views? Are there any other things we should know?
Environment: Eclipse Ganymede, Windows XP.
A single Eclipse workbench can create multiple windows. Each window is laid out using a perspective, so different windows could be set to different perspectives, or the same perspective, and you can switch perspectives in each window independently of the other windows.
You can also set input for each window. This is useful if each window is working on different data (for example, each window could be connected to a different server or could be showing data from different databases that all have the same schema but different data).
It may be that you are using windows only so that you can see different perspectives of the same data on different monitors. In that case you do not need to programatically create the windows but need only add the action supplied by the workbench. This can be done by modifying your ActionBarAdvisor class:
add to the field declarations:
private IWorkbenchAction newWindowAction;
add to the code where you make the actions (typically a method called makeActions):
newWindowAction = ActionFactory.OPEN_NEW_WINDOW.create(window);
register(newWindowAction);
add to the code where you create the menus:
menu.add(newWindowAction);
where menu is typically the Window menu. If you don't have a Window menu already in your application and would like to create one, the following line will work:
MenuManager menu = new MenuManager(
"&Window",
IWorkbenchActionConstants.M_WINDOW);
This will give you a menu item that will create a new window in the same way as the Window->New Window menu item in the Eclipse IDE.
If, on the other hand, you want each window to show different data then you will need to open the new windows programatically. This allows you to set different input for each window. You will need a line of code something like:
IWorkbenchPage newPage = window.openPage(inputObject);
where inputObject contains information that identifies the data shown in the window. If you want to set the initial perspective this can be done by calling setPerspective on the page.
You will want to set the title in each window:
newPage.getWorkbenchWindow().getShell().setText(windowTitle);
where windowTitle is a string describing the input to the window.
You can fetch the input for a window as follows:
window.getActivePage().getInput()
You can then cast this to whatever class you are using as your window input.