Example usage for org.eclipse.jdt.internal.core SourceType getAncestor

List of usage examples for org.eclipse.jdt.internal.core SourceType getAncestor

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.core SourceType getAncestor.

Prototype

IJavaElement getAncestor(int ancestorType);

Source Link

Document

Returns this Java element or the first ancestor of this element that has the given type.

Usage

From source file:org.wso2.developerstudio.eclipse.ui.widgets.FromWS.java

License:Open Source License

public void browseClassFile() {
    FilteredTypesSelectionDialog dialog = new FilteredTypesSelectionDialog(
            Display.getCurrent().getActiveShell(), true, PlatformUI.getWorkbench().getProgressService(),
            new JavaWorkspaceScope(), IJavaSearchConstants.CLASS);
    dialog.setTitle("Registry Handler Class");
    dialog.setMessage("Select a java class to create the Registry Handler from");

    if (dialog.open() == Window.OK) {
        SourceType firstResult = (SourceType) dialog.getFirstResult();
        IJavaProject p = (IJavaProject) firstResult.getAncestor(2);
        pathText.setText(firstResult.getFullyQualifiedName());
    }//w w  w  .j  a  va  2 s  .co m
}