Java 类org.eclipse.ui.views.properties.tabbed.ITabDescriptor 实例源码
项目:seg.jUCMNav
文件:GEFTabbedPropertySheetPage.java
protected TabContents createTab(ITabDescriptor tabDescriptor) {
TabContents content = super.createTab(tabDescriptor);
ISection[] sections = content.getSections();
for (int i = 0; i < sections.length; i++) {
if (sections[i] instanceof AbstractGEFPropertySection) {
AbstractGEFPropertySection current = (AbstractGEFPropertySection) sections[i];
if (!maxLabelWidth.containsKey(tabDescriptor.getId()))
maxLabelWidth.put(tabDescriptor.getId(), ""); //$NON-NLS-1$
sectionToTab.put(current, tabDescriptor.getId());
if (current.getLabelText().length() > ((String) maxLabelWidth.get(tabDescriptor.getId())).length()) {
maxLabelWidth.put(tabDescriptor.getId(), current.getLabelText());
}
}
}
return content;
}
项目:eavp
文件:TabDescriptorProvider.java
/**
* Sets and returns {@link #tabDescriptors} based on the current selection.
*/
@Override
public ITabDescriptor[] getTabDescriptors(IWorkbenchPart part,
ISelection selection) {
// Reset the tab descriptors.
tabDescriptors.clear();
// Get the IMeshPart from the selection and visit it.
Assert.isTrue(selection instanceof IStructuredSelection);
IStructuredSelection structuredSelection = (IStructuredSelection) selection;
// TODO Incorporate multiple elements from the selection.
// Visit the selected IMeshPart if possible.
if (!structuredSelection.isEmpty()) {
Object element = structuredSelection.getFirstElement();
Assert.isTrue(element instanceof MeshSelection);
MeshSelection meshSelection = (MeshSelection) element;
// Get the mesh from the selection.
mesh = meshSelection.mesh;
// Create the right collection of tabs based on the part's type
if (meshSelection.selectedMeshPart instanceof FaceController) {
createTabs((FaceController) meshSelection.selectedMeshPart);
} else if (meshSelection.selectedMeshPart instanceof EdgeController) {
createTabs((EdgeController) meshSelection.selectedMeshPart);
} else if (meshSelection.selectedMeshPart instanceof VertexController) {
createTabs((VertexController) meshSelection.selectedMeshPart);
}
}
// Convert the List of ITabDescriptors into an array..
return tabDescriptors
.toArray(new ITabDescriptor[tabDescriptors.size()]);
}
项目:NIEM-Modeling-Tool
文件:NIEMXwtTabDescriptorProvider.java
@Override
public ITabDescriptor[] getTabDescriptors(final IWorkbenchPart part, final ISelection selection) {
if (selection != previousSelection || part != previousPart) {
previousSelection = selection;
previousPart = part;
final List<ITabDescriptor> descriptors = new LinkedList<ITabDescriptor>();
final Set<View> views = ConfigurationManager.getInstance().getConstraintEngine().getViews(selection);
if (!views.isEmpty()) {
descriptors.addAll(getDisplay(part).getTabDescriptors(views));
}
final ITabbedPropertySheetPageContributor contributor = part instanceof ITabbedPropertySheetPageContributor ? (ITabbedPropertySheetPageContributor) part
: (ITabbedPropertySheetPageContributor) part.getAdapter(ITabbedPropertySheetPageContributor.class);
@SuppressWarnings("restriction")
final org.eclipse.ui.internal.views.properties.tabbed.view.TabbedPropertyRegistryFactory tabbedPropertyRegistryFactory = org.eclipse.ui.internal.views.properties.tabbed.view.TabbedPropertyRegistryFactory
.getInstance();
if (contributor != null) {
@SuppressWarnings("restriction")
final org.eclipse.ui.internal.views.properties.tabbed.view.TabbedPropertyRegistry registry = tabbedPropertyRegistryFactory
.createRegistry(contributor);
final ITabDescriptor[] registeredTabDesriptors = call("getAllTabDescriptors", registry);
if (registeredTabDesriptors != null) {
for (final ITabDescriptor descriptor : registeredTabDesriptors) {
if (descriptor.getSectionDescriptors().size() > 0) {
descriptors.add(descriptor);
}
}
}
}
orderTabDescriptors(descriptors);
cachedResult = descriptors.toArray(new ITabDescriptor[descriptors.size()]);
dispose(tabbedPropertyRegistryFactory, contributor);
}
return cachedResult;
}
项目:seg.jUCMNav
文件:GEFTabbedPropertySheetPage.java
protected void updateTabs(ITabDescriptor[] descriptors) {
maxLabelWidth.clear();
sectionToTab.clear();
super.updateTabs(descriptors);
}