Search in sources :

Example 1 with ISection

use of org.eclipse.ui.views.properties.tabbed.ISection in project tdi-studio-se by Talend.

the class PartListener method validatePart.

/**
     * Validates the given part.
     * 
     * @param partRef
     *            The part reference
     * @return True if the given part is valid for further operation
     */
private boolean validatePart(IWorkbenchPartReference partRef) {
    // check if the part is a property sheet
    if (!partRef.getId().equals(IPageLayout.ID_PROP_SHEET)) {
        return false;
    }
    // check if the property sheet is the corresponding one
    if (!propertySection.getPropertySheetId().equals(partRef.getPart(false).toString())) {
        return false;
    }
    // checks if the section is the corresponding one
    TabContents currentTab = tabbedPropertySheetPage.getCurrentTab();
    if (currentTab == null) {
        return false;
    }
    ISection[] sections = currentTab.getSections();
    if (sections == null || sections.length == 0 || !propertySection.equals(sections[0])) {
        return false;
    }
    return true;
}
Also used : ISection(org.eclipse.ui.views.properties.tabbed.ISection) TabContents(org.eclipse.ui.views.properties.tabbed.TabContents)

Example 2 with ISection

use of org.eclipse.ui.views.properties.tabbed.ISection in project tdi-studio-se by Talend.

the class FindDialog method getFindTarget.

/**
     * Gets the target for find action.
     * 
     * @return The target for find action
     */
private static IFindTarget getFindTarget() {
    IWorkbenchPart activePart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart();
    if (activePart instanceof IFindTarget) {
        return (IFindTarget) activePart;
    }
    PropertySheet part = (PropertySheet) activePart;
    if (part == null) {
        return null;
    }
    IPage page = part.getCurrentPage();
    if (!(page instanceof TabbedPropertySheetPage)) {
        return null;
    }
    TabbedPropertySheetPage propertySheetPage = (TabbedPropertySheetPage) page;
    ISection[] sections = propertySheetPage.getCurrentTab().getSections();
    if (sections.length != 1) {
        return null;
    }
    ISection section = sections[0];
    if (!(section instanceof IFindTarget)) {
        return null;
    }
    return (IFindTarget) section;
}
Also used : ISection(org.eclipse.ui.views.properties.tabbed.ISection) IFindTarget(org.talend.designer.runtime.visualization.internal.ui.properties.cpu.actions.FindAction.IFindTarget) IPage(org.eclipse.ui.part.IPage) PropertySheet(org.eclipse.ui.views.properties.PropertySheet) IWorkbenchPart(org.eclipse.ui.IWorkbenchPart) TabbedPropertySheetPage(org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)

Aggregations

ISection (org.eclipse.ui.views.properties.tabbed.ISection)2 IWorkbenchPart (org.eclipse.ui.IWorkbenchPart)1 IPage (org.eclipse.ui.part.IPage)1 PropertySheet (org.eclipse.ui.views.properties.PropertySheet)1 TabContents (org.eclipse.ui.views.properties.tabbed.TabContents)1 TabbedPropertySheetPage (org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)1 IFindTarget (org.talend.designer.runtime.visualization.internal.ui.properties.cpu.actions.FindAction.IFindTarget)1