类org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage源码实例Demo

下面列出了怎么用org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage的API类实例代码及写法,或者点击链接到github查看源代码。

private ITabbedPropertySelectionProvider findDefaultProvider(final IWorkbenchPart editorPart,
        final IGraphicalEditPart editPart) {
    final String selectedViewId = activePropertyView(activePage);
    String selectedTabId = null;
    ITabbedPropertySelectionProvider defaultProvider = null;
    if (selectedViewId != null) {
        selectedTabId = activePropertyTabId(activePage, selectedViewId);
        final TabbedPropertySheetPage propertySheetPage = activePropertyTab(activePage, selectedViewId);
        if (propertySheetPage != null && propertySheetPage.getSelectedTab() != null) {
            final List<ISectionDescriptor> sectionDescriptors = propertySheetPage.getSelectedTab().getSectionDescriptors();
            for (final ISectionDescriptor descriptor : sectionDescriptors) {
                if (descriptor.appliesTo(editorPart, new StructuredSelection(editPart))) {
                    defaultProvider = DefaultTabbedPropertyProvider.defaultProvider(selectedViewId, selectedTabId);
                    break;
                }
            }
        }
    }
    return defaultProvider;
}
 
源代码2 项目: bonita-studio   文件: TextPropertySection.java
public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) {
    super.createControls(parent, aTabbedPropertySheetPage);
    Composite composite = getWidgetFactory().createFlatFormComposite(parent);
    
    FormData data;

    this.text = getWidgetFactory().createText(composite, getDefaultValue()); //$NON-NLS-1$
    
    data = new FormData();
    data.left = new FormAttachment(0, STANDARD_LABEL_WIDTH);
    data.right = new FormAttachment(textBoxSize, 0);
    data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
    this.text.setLayoutData(data);

    CLabel labelLabel = getWidgetFactory().createCLabel(composite, getPropertyDefinition().getName()); //$NON-NLS-1$
    data = new FormData();
    data.left = new FormAttachment(0, 0);
    data.right = new FormAttachment(text, -ITabbedPropertyConstants.HSPACE);
    data.top = new FormAttachment(text, 0, SWT.CENTER);
    labelLabel.setLayoutData(data);
}
 
源代码3 项目: elexis-3-core   文件: StammDatenComposite.java
public StammDatenComposite(Composite parent, int style, TabbedPropertySheetPage tpsp){
	this(parent, style);
	tpsf = tpsp.getWidgetFactory();
	if (tpsf != null) {
		tpsf.adapt(compositeHeader);
		tpsf.paintBordersFor(compositeHeader);
		tpsf.adapt(lblContactType, true, false);
		tpsf.adapt(lblHeadline, true, false);
		tpsf.adapt(lblCode, true, true);
		tpsf.adapt(comboViewerSex.getCombo());
		tpsf.paintBordersFor(comboViewerSex.getCombo());
		tpsf.paintBordersFor(dateTimeDob);
		tpsf.adapt(dateTimeDob);
		tpsf.adapt(comboViewerCountry.getCombo());
		tpsf.paintBordersFor(comboViewerCountry.getCombo());
		tpsf.adapt(btnEmail, true, true);
		tpsf.adapt(btnWebsite, true, true);
		tpsf.adapt(txtNotes, true, true);
	}
}
 
@Override
public final void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) {
	toolkit = new FormToolkit(parent.getDisplay());
	toolkit.setBorderStyle(SWT.BORDER);
	super.createControls(parent, aTabbedPropertySheetPage);
	GridDataFactory.fillDefaults().grab(true, true).applyTo(parent);
	parent.setLayout(new GridLayout(1, true));
	form = toolkit.createForm(parent);
	toolkit.decorateFormHeading(form);
	GridDataFactory.fillDefaults().grab(true, true).applyTo(form);
	form.getBody().setLayout(createBodyLayout());
	createControls(form.getBody());
}
 
public Object getAdapter(Object adaptableObject, Class adapterType) {
    if (adaptableObject instanceof ProjectExplorer) {
    	if (IPropertySheetPage.class == adapterType)
            return new TabbedPropertySheetPage(
                new TabbedPropertySheetProjectExplorerContributor(
                    (CommonNavigator) adaptableObject));
    }
    return null;
}
 
public Object getAdapter(Object adaptableObject, Class adapterType) {
    if (adaptableObject instanceof ProjectExplorer) {
    	if (IPropertySheetPage.class == adapterType)
            return new TabbedPropertySheetPage(
                new TabbedPropertySheetProjectExplorerContributor(
                    (CommonNavigator) adaptableObject));
    }
    return null;
}
 
源代码7 项目: ice   文件: ReflectivityPage.java
/**
 * Needed for the properties tab attributes to be registered for this page.
 * Makes sure that the IPropertySheetPage class returns this as a new
 * TabbedPropertySheetPage so that the properties tab uses the Reflectivity
 * properties rather than the standard eclipse properties view
 */
@Override
public Object getAdapter(Class adapter) {
	if (adapter == IPropertySheetPage.class) {
		return new TabbedPropertySheetPage(this);
	}
	return super.getAdapter(adapter);
}
 
源代码8 项目: ice   文件: GeometryFormEditor.java
@Override
public Object getAdapter(Class adapter) {

	// Give the TabbedPropertySheetPage for the IPropertySheetPage
	if (adapter == IPropertySheetPage.class) {
		return new TabbedPropertySheetPage(this);
	}

	// Otherwise delegate to the superclass
	else {
		return super.getAdapter(adapter);
	}
}
 
源代码9 项目: ice   文件: TreeCompositeViewer.java
/**
 * This operation creates an adapter that allows this viewer to publish
 * information in the properties view.
 */
@Override
public Object getAdapter(Class adapter) {
	// If the requested adapter is a property page, send in the one for the
	// TreeComposite.
	if (adapter == IPropertySheetPage.class) {
		return new TabbedPropertySheetPage(this);
	}
	// Otherwise bump this up to the parent.
	return super.getAdapter(adapter);
}
 
源代码10 项目: ice   文件: ICEMeshPage.java
@Override
public Object getAdapter(Class adapter) {
	if (adapter == IPropertySheetPage.class) {
		return new TabbedPropertySheetPage(this);
	}
	return super.getAdapter(adapter);
}
 
源代码11 项目: ice   文件: MeshElementTreeView.java
@Override
public Object getAdapter(Class adapter) {
	if (adapter == IPropertySheetPage.class) {
		return new TabbedPropertySheetPage(this);
	}
	return super.getAdapter(adapter);
}
 
private void updateSelectedTabInPage(final EObject element, final ITabbedPropertySelectionProvider selectionProvider, final IViewPart part) {
    final TabbedPropertySheetPage page = (TabbedPropertySheetPage) part.getAdapter(TabbedPropertySheetPage.class);
    if (page != null) {
        page.setSelectedTab(selectionProvider.tabId(element));
        if (selectionProvider instanceof ITabbedSectionPropertyProvider) {
            final PropertySectionWithTabs sectionWithTabs = findSectionWithTabs(page);
            if (sectionWithTabs != null) {
                sectionWithTabs.setSelectedTab(((ITabbedSectionPropertyProvider) selectionProvider).tabIndex());
            }
        }
    }
}
 
private String activePropertyView(final IWorkbenchPage activePage) {
    for (final IViewReference ref : activePage.getViewReferences()) {
        final IWorkbenchPart part = ref.getPart(false);
        if (part != null && activePage.isPartVisible(part)) {
            final TabbedPropertySheetPage sheetPage = (TabbedPropertySheetPage) part.getAdapter(TabbedPropertySheetPage.class);
            if (sheetPage != null) {
                return ref.getId();
            }
        }
    }
    return null;
}
 
private String activePropertyTabId(final IWorkbenchPage activePage, final String viewId) {
    final IViewPart view = activePage.findView(viewId);
    final TabbedPropertySheetPage propertySheetPage = (TabbedPropertySheetPage) view.getAdapter(TabbedPropertySheetPage.class);
    if (propertySheetPage != null && propertySheetPage.getSelectedTab() != null) {
        return propertySheetPage.getSelectedTab().getId();
    }
    return null;
}
 
private TabbedPropertySheetPage activePropertyTab(final IWorkbenchPage activePage, final String viewId) {
    final IViewPart view = activePage.findView(viewId);
    final TabbedPropertySheetPage propertySheetPage = (TabbedPropertySheetPage) view.getAdapter(TabbedPropertySheetPage.class);
    if (propertySheetPage != null) {
        return propertySheetPage;
    }
    return null;
}
 
private PropertySectionWithTabs findSectionWithTabs(final TabbedPropertySheetPage page) {
    final TabContents currentTab = page.getCurrentTab();
    if (currentTab != null) {
        return (PropertySectionWithTabs) find(newArrayList(currentTab.getSections()), instanceOf(PropertySectionWithTabs.class), null);
    }
    return null;
}
 
@Override
public void run() {
    for (final IViewReference vr : viewReferences()) {
        final TabbedPropertySheetPage propertyPage = (TabbedPropertySheetPage) vr.getView(true).getAdapter(TabbedPropertySheetPage.class);
        if (propertyPage != null) {
            propertyPage.selectionChanged(part, newSelection);
        }
    }
}
 
@Test
public void should_update_property_views_with_new_selection() throws Exception {
    final RefreshPropertyViewsSelection refreshPropertyViewsSelection = spy(new RefreshPropertyViewsSelection(part, newSelection));
    final TabbedPropertySheetPage propertySheetPage1 = mock(TabbedPropertySheetPage.class);
    final TabbedPropertySheetPage propertySheetPage2 = mock(TabbedPropertySheetPage.class);
    doReturn(new IViewReference[] { propertyViewRef(propertySheetPage1), propertyViewRef(propertySheetPage2), propertyViewRef(null) }).when(
            refreshPropertyViewsSelection)
            .viewReferences();

    refreshPropertyViewsSelection.run();

    verify(propertySheetPage1).selectionChanged(part, newSelection);
    verify(propertySheetPage2).selectionChanged(part, newSelection);
}
 
private IViewReference propertyViewRef(final TabbedPropertySheetPage sheetPage) {
    final IViewReference viewReference = mock(IViewReference.class);
    final IViewPart iViewPart = mock(IViewPart.class);
    doReturn(iViewPart).when(viewReference).getView(true);
    doReturn(sheetPage).when(iViewPart).getAdapter(TabbedPropertySheetPage.class);
    return viewReference;
}
 
@Before
public void setUp() throws Exception {
    when(processEditorReference.getId()).thenReturn("org.bonitasoft.studio.model.process.diagram.part.CustomProcessDiagramEditorID");
    when(processEditorReference.getPart(false)).thenReturn(editorPart);
    when(activePage.getActiveEditor()).thenReturn(editorPart);
    when(activePage.getViewReferences()).thenReturn(new IViewReference[] {});
    when(activePage.showView(anyString())).thenReturn(viewPart);
    when(viewPart.getAdapter(TabbedPropertySheetPage.class)).thenReturn(page);
    when(editorPart.getDiagramEditPart()).thenReturn(new DiagramEditPart(NotationFactory.eINSTANCE.createDiagram()));
    when(editorPart.getDiagramGraphicalViewer()).thenReturn(viewer);
    doReturn(aControlWithDisplay(display)).when(viewer).getControl();
    when(editPartResolver.findEditPart(any(DiagramEditPart.class), notNull(EObject.class))).thenReturn(editPart);
    doReturn(new IEditorReference[] { processEditorReference }).when(activePage).getEditorReferences();
}
 
源代码21 项目: bonita-studio   文件: OperationsComposite.java
public OperationsComposite(final TabbedPropertySheetPage tabbedPropertySheetPage,
        final Composite mainComposite, final ViewerFilter actionExpressionFilter,
        final ViewerFilter storageExpressionFilter, final boolean isPageFlowContext) {
    super(mainComposite, SWT.NONE);
    parent = mainComposite;
    setLayout(GridLayoutFactory.fillDefaults().numColumns(1).margins(0, 0).extendedMargins(0, 20, 0, 0).create());
    operationComposite = new Composite(this, SWT.NONE);
    operationComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).margins(0, 0).spacing(0, 5).create());
    operationComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    final Composite buttonComposite = new Composite(this, SWT.NONE);
    buttonComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).create());
    buttonComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).span(2, 1).create());
    this.isPageFlowContext = isPageFlowContext;
    if (tabbedPropertySheetPage != null) {
        widgetFactory = tabbedPropertySheetPage.getWidgetFactory();
        if (widgetFactory != null) {
            widgetFactory.adapt(this);
            widgetFactory.adapt(operationComposite);
            widgetFactory.adapt(buttonComposite);
        }
        this.tabbedPropertySheetPage = tabbedPropertySheetPage;
    }
    this.actionExpressionFilter = actionExpressionFilter;
    this.storageExpressionFilter = storageExpressionFilter;

    createAddButton(buttonComposite);

    operationListlistener = new IListChangeListener() {

        @Override
        public void handleListChange(ListChangeEvent event) {
            for (final Object operation : event.getObservableList()) {
                final int operationIndex = event.getObservableList().indexOf(operation);
                if (operationViewers.size() > operationIndex) {
                    operationViewers.get(operationIndex).setOperation((Operation) operation);
                }
            }
        }
    };
}
 
public WizardPageOperationsComposite(
		final TabbedPropertySheetPage tabbedPropertySheetPage,
		final Composite mainComposite, final ViewerFilter actionExpressionFilter,
		final ViewerFilter storageExpressionFilter) {
	super(tabbedPropertySheetPage, mainComposite, actionExpressionFilter,
			storageExpressionFilter);
}
 
public PropertyOperationsComposite(
		TabbedPropertySheetPage tabbedPropertySheetPage,
		Composite mainComposite, ViewerFilter actionExpressionFilter,
		ViewerFilter storageExpressionFilter) {
	super(tabbedPropertySheetPage, mainComposite, actionExpressionFilter,
			storageExpressionFilter);
}
 
源代码24 项目: bonita-studio   文件: PoolGeneralPropertySection.java
private void updatePropertyTabTitle(String poolName) {
    if (poolName != null) {
        TabbedPropertySheetPage tabbedPropertySheetPage = getTabbedPropertySheetPage();
        final TabbedPropertyComposite tabbedPropertyComposite = (TabbedPropertyComposite) tabbedPropertySheetPage
                .getControl();
        final TabbedPropertyTitle title = tabbedPropertyComposite.getTitle();
        if (title != null) {
            title.setTitle(poolName, tabbedPropertySheetPage.getTitleImage(getSelection()));
        }
    }
}
 
@Override
public void createControls(final Composite parent, final TabbedPropertySheetPage aTabbedPropertySheetPage) {
    super.createControls(parent, aTabbedPropertySheetPage);
    propertySectionHistory = new PropertySectionHistory(getClass().getSimpleName());
    propertySectionHistory.load();

    parent.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).margins(0, 0).create());
    parent.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    tabbedPropertySheetPage = aTabbedPropertySheetPage;
    final TabbedPropertySheetWidgetFactory widgetFactory = tabbedPropertySheetPage.getWidgetFactory();
    form = widgetFactory.createForm(parent);
    form.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).margins(0, 0).create());
    form.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    form.setText(getSectionTitle());

    final Composite formBodyComposite = form.getBody();
    formBodyComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).margins(0, 0).create());
    formBodyComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());

    togglePropertyHelpContributionItem = new TogglePropertyHelpContributionItem(widgetFactory, form,
            getSectionDescription(),getDescriptionSeverity(), propertySectionHistory);
    updateToolbar(form.getToolBarManager());
    form.getToolBarManager().add(togglePropertyHelpContributionItem);
    form.getToolBarManager().update(true);
    createContent(formBodyComposite);

    form.update();
    form.setFocus();
}
 
源代码26 项目: bonita-studio   文件: PropertySelectionProvider.java
public void fireSelectionChanged(IGraphicalEditPart ep, EObject element) {
    TabbedPropertySheetPage page;
    try {
        if (element == null) {
            element = ep.resolveSemanticElement();
        }
        page = getTabbedPropertySheetPage(element);
        if (page != null) {
            page.selectionChanged(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(),
                    new StructuredSelection(ep));
        }
    } catch (PartInitException e) {
        BonitaStudioLog.error(e);
    }
}
 
源代码27 项目: bonita-studio   文件: PropertySelectionProvider.java
private TabbedPropertySheetPage getTabbedPropertySheetPage(EObject element) throws PartInitException {
    IViewPart viewPart = null;
    for (IViewReference vr : PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getViewReferences()) {
        if (vr.getId().equals("org.bonitasoft.studio.views.properties.process.general")) {
            viewPart = vr.getView(true);
        }
    }
    if (viewPart != null) {
        viewPart.getViewSite().getWorkbenchWindow().getActivePage().showView(viewPart.getSite().getId());
        return (TabbedPropertySheetPage) viewPart.getAdapter(TabbedPropertySheetPage.class);
    }
    return null;
}
 
源代码28 项目: elexis-3-core   文件: ContactSelectorView.java
@Override
public Object getAdapter(@SuppressWarnings("rawtypes")
Class adapter){
	if (adapter == IPropertySheetPage.class)
		return new TabbedPropertySheetPage(this);
	return super.getAdapter(adapter);
}
 
源代码29 项目: elexis-3-core   文件: UserManagementTab.java
@Override
public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage){
	super.createControls(parent, aTabbedPropertySheetPage);
	umc = new UserManagementComposite(parent, SWT.None, aTabbedPropertySheetPage);
	aTabbedPropertySheetPage.getWidgetFactory().adapt(umc);
	aTabbedPropertySheetPage.getWidgetFactory().paintBordersFor(umc);
}
 
源代码30 项目: elexis-3-core   文件: StammdatenTab.java
@Override
public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage){
	super.createControls(parent, aTabbedPropertySheetPage);
	sdc = new StammDatenComposite(parent, SWT.None, aTabbedPropertySheetPage);
	aTabbedPropertySheetPage.getWidgetFactory().adapt(sdc);
	aTabbedPropertySheetPage.getWidgetFactory().paintBordersFor(sdc);
}
 
 类所在包
 类方法
 同包方法