user310291
user310291

Reputation: 38180

How to get an Id Perspective of Eclipse?

It is possible to launch eclipse with -perspective idPerspective

so how can I get this idPerspective ?

Upvotes: 5

Views: 2448

Answers (3)

Erik Lievaart
Erik Lievaart

Reputation: 433

place this script in your eclipse plugin dir and run it

#!/bin/sh

for jar in $(find . -name '*.jar')
do
    plugin=$(zipinfo -l "$jar" plugin.xml 2> /dev/null)
    if [ "$plugin" = "" ]
    then
        continue
    fi

    preferences=$(unzip -q -c "$jar" 'plugin.xml' | xmlstarlet sel -t -v '//perspective/@id')
    if [ "$preferences" != "" ]
    then
        echo "$preferences\n"
    fi
done

Upvotes: 1

Ryan Armstrong
Ryan Armstrong

Reputation: 421

Without PDE and without searching JAR files, you can also look inside your workspace metadata folder for the workbench configuration file. In my setup, the path is {workspace}/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xml. Simply search the contents of this file for the key phrase persp.perspSC. You will see some lines such as:

<tags>persp.perspSC:org.eclipse.jdt.ui.JavaPerspective</tags>
<tags>persp.perspSC:org.eclipse.jdt.ui.JavaBrowsingPerspective</tags>

Where the text after the colon is the perspective ID.

Upvotes: 3

zvikico
zvikico

Reputation: 9825

If you are running Eclipse with PDE (Plugin Development Environment), hit ALT+Shift+F2 to use the Plugin Menu Spy. The cursor will change its' shape, now press the desired perspective button and you will get the perspective ID.

Another option is to run a plug-in search (from Search → Plugin). Look for the string "org.eclipse.ui.perspectives" which is the name of the extension point that defines a perspective.

If you don't have PDE, you can search for the same string in the plugin.xml files which are found inside the plugins JARs. If you have a tool that can search within JARs, that would be helpful. Otherwise, you will need to guess which JAR to open for the search (or open all the JARs).

Upvotes: 9

Related Questions