org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage Java Examples

The following examples show how to use org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TextPropertySection.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example #2
Source File: TabbedPropertySynchronizerListener.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example #3
Source File: StammDatenComposite.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
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);
	}
}
 
Example #4
Source File: RefreshPropertyViewsSelectionTest.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@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);
}
 
Example #5
Source File: TabbedPropertySheetAdapterFactory.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
public Object getAdapter(Object adaptableObject, Class adapterType) {
    if (adaptableObject instanceof ProjectExplorer) {
    	if (IPropertySheetPage.class == adapterType)
            return new TabbedPropertySheetPage(
                new TabbedPropertySheetProjectExplorerContributor(
                    (CommonNavigator) adaptableObject));
    }
    return null;
}
 
Example #6
Source File: RefreshPropertyViewsSelectionTest.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #7
Source File: TabbedPropertySynchronizerListenerTest.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@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();
}
 
Example #8
Source File: OperationsComposite.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
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);
                }
            }
        }
    };
}
 
Example #9
Source File: FaelleTab.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage){
	super.createControls(parent, aTabbedPropertySheetPage);
	fc = new FaelleComposite(parent, SWT.None, aTabbedPropertySheetPage);
	aTabbedPropertySheetPage.getWidgetFactory().adapt(fc);
	aTabbedPropertySheetPage.getWidgetFactory().paintBordersFor(fc);
	subActionBars = new SubActionBars(aTabbedPropertySheetPage.getSite().getActionBars());
	
	// COMPAT
	subActionBars.getToolBarManager().add(GlobalActions.neuerFallAction);
}
 
Example #10
Source File: WizardPageOperationsComposite.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
public WizardPageOperationsComposite(
		final TabbedPropertySheetPage tabbedPropertySheetPage,
		final Composite mainComposite, final ViewerFilter actionExpressionFilter,
		final ViewerFilter storageExpressionFilter) {
	super(tabbedPropertySheetPage, mainComposite, actionExpressionFilter,
			storageExpressionFilter);
}
 
Example #11
Source File: StammdatenTab.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
@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);
}
 
Example #12
Source File: UserManagementTab.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
@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);
}
 
Example #13
Source File: ContactSelectorView.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public Object getAdapter(@SuppressWarnings("rawtypes")
Class adapter){
	if (adapter == IPropertySheetPage.class)
		return new TabbedPropertySheetPage(this);
	return super.getAdapter(adapter);
}
 
Example #14
Source File: PropertyOperationsComposite.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
public PropertyOperationsComposite(
		TabbedPropertySheetPage tabbedPropertySheetPage,
		Composite mainComposite, ViewerFilter actionExpressionFilter,
		ViewerFilter storageExpressionFilter) {
	super(tabbedPropertySheetPage, mainComposite, actionExpressionFilter,
			storageExpressionFilter);
}
 
Example #15
Source File: PoolGeneralPropertySection.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
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()));
        }
    }
}
 
Example #16
Source File: PropertySelectionProvider.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #17
Source File: PropertySelectionProvider.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
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);
    }
}
 
Example #18
Source File: AbstractBonitaDescriptionSection.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@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();
}
 
Example #19
Source File: TabbedPropertySynchronizerListener.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #20
Source File: TabbedPropertySheetAdapterFactory.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
public Object getAdapter(Object adaptableObject, Class adapterType) {
    if (adaptableObject instanceof ProjectExplorer) {
    	if (IPropertySheetPage.class == adapterType)
            return new TabbedPropertySheetPage(
                new TabbedPropertySheetProjectExplorerContributor(
                    (CommonNavigator) adaptableObject));
    }
    return null;
}
 
Example #21
Source File: ReflectivityPage.java    From ice with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * 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);
}
 
Example #22
Source File: AbstractEditorPropertySection.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
@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());
}
 
Example #23
Source File: GeometryFormEditor.java    From ice with Eclipse Public License 1.0 5 votes vote down vote up
@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);
	}
}
 
Example #24
Source File: TreeCompositeViewer.java    From ice with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * 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);
}
 
Example #25
Source File: UserManagementComposite.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
public UserManagementComposite(Composite parent, int style, TabbedPropertySheetPage tpsp){
	this(parent, style);
	tpsf = tpsp.getWidgetFactory();
	if (tpsf != null) {
		tpsf.adapt(anwenderGroup);
		tpsf.paintBordersFor(anwenderGroup);
		tpsf.adapt(mandantGroup);
		tpsf.paintBordersFor(mandantGroup);
	}
}
 
Example #26
Source File: ICEMeshPage.java    From ice with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public Object getAdapter(Class adapter) {
	if (adapter == IPropertySheetPage.class) {
		return new TabbedPropertySheetPage(this);
	}
	return super.getAdapter(adapter);
}
 
Example #27
Source File: MeshElementTreeView.java    From ice with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public Object getAdapter(Class adapter) {
	if (adapter == IPropertySheetPage.class) {
		return new TabbedPropertySheetPage(this);
	}
	return super.getAdapter(adapter);
}
 
Example #28
Source File: TabbedPropertySynchronizerListener.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
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());
            }
        }
    }
}
 
Example #29
Source File: TabbedPropertySynchronizerListener.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #30
Source File: TabbedPropertySynchronizerListener.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
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;
}