List of usage examples for org.eclipse.jface.viewers IBasicPropertyConstants P_TEXT
String P_TEXT
To view the source code for org.eclipse.jface.viewers IBasicPropertyConstants P_TEXT.
Click Source Link
"org.eclipse.jface.text") for an element's label text. From source file:com.aptana.deploy.wizard.DataTransferWizardCollectionComparator.java
License:Open Source License
/** * Return true if this sorter is affected by a property change of propertyName on the specified element. *//* w w w .j ava 2 s . com*/ public boolean isSorterProperty(Object object, String propertyId) { return propertyId.equals(IBasicPropertyConstants.P_TEXT); }
From source file:com.siteview.mde.internal.ui.shared.target.TargetContentsGroup.java
License:Open Source License
/** * Creates the tree in this group// ww w. ja v a 2 s . co m * * @param parent parent composite * @param style toolkit for form style or <code>null</code> for dialog style */ private TreeViewer createTree(Composite parent, FormToolkit toolkit) { FilteredCheckboxTree tree = new FilteredCheckboxTree(parent, toolkit); tree.setLayoutData(new GridData(GridData.FILL_BOTH)); tree.getPatternFilter().setIncludeLeadingWildcard(true); tree.getFilterControl().setFont(parent.getFont()); fTree = tree.getCheckboxTreeViewer(); ((GridData) fTree.getControl().getLayoutData()).heightHint = 300; fTree.getControl().setFont(parent.getFont()); fTree.setUseHashlookup(true); fTree.setContentProvider(new TreeContentProvider()); fTree.setLabelProvider(new StyledBundleLabelProvider(true, false)); fTree.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { IStructuredSelection selection = (IStructuredSelection) event.getSelection(); Object first = selection.getFirstElement(); fTree.setChecked(first, !fTree.getChecked(first)); saveIncludedBundleState(); contentChanged(); updateButtons(); fTree.update(fTargetDefinition.getBundleContainers(), new String[] { IBasicPropertyConstants.P_TEXT }); } }); fTree.addCheckStateListener(new ICheckStateListener() { public void checkStateChanged(CheckStateChangedEvent event) { saveIncludedBundleState(); contentChanged(); updateButtons(); fTree.update(fTargetDefinition.getBundleContainers(), new String[] { IBasicPropertyConstants.P_TEXT }); } }); fTree.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { updateButtons(); } }); fTree.setSorter(new ViewerSorter() { public int compare(Viewer viewer, Object e1, Object e2) { if (fFeaureModeButton.getSelection()) { if (e1 == OTHER_CATEGORY) { return 1; } if (e2 == OTHER_CATEGORY) { return -1; } } if (e1 instanceof IResolvedBundle && !(e2 instanceof IResolvedBundle)) { return -1; } if (e2 instanceof IResolvedBundle && !(e1 instanceof IResolvedBundle)) { return 1; } if (e1 instanceof IResolvedBundle && e2 instanceof IResolvedBundle) { IStatus status1 = ((IResolvedBundle) e1).getStatus(); IStatus status2 = ((IResolvedBundle) e2).getStatus(); if (!status1.isOK() && status2.isOK()) { return -1; } if (status1.isOK() && !status2.isOK()) { return 1; } } return super.compare(viewer, e1, e2); } }); fMenuManager = new MenuManager(); fMenuManager.add(new Action(Messages.TargetContentsGroup_collapseAll, PlatformUI.getWorkbench() .getSharedImages().getImageDescriptor(ISharedImages.IMG_ELCL_COLLAPSEALL)) { public void run() { fTree.collapseAll(); } }); Menu contextMenu = fMenuManager.createContextMenu(tree); tree.setMenu(contextMenu); return fTree; }
From source file:com.siteview.mde.internal.ui.shared.target.TargetContentsGroup.java
License:Open Source License
/** * Creates the buttons in this group inside a new composite * //from w ww . ja v a2 s . co m * @param parent parent composite * @param toolkit toolkit to give form style or <code>null</code> for dialog style */ private void createButtons(Composite parent, FormToolkit toolkit) { if (toolkit != null) { Composite buttonComp = toolkit.createComposite(parent); GridLayout layout = new GridLayout(); layout.marginWidth = layout.marginHeight = 0; buttonComp.setLayout(layout); buttonComp.setLayoutData(new GridData(GridData.FILL_VERTICAL)); fSelectButton = toolkit.createButton(buttonComp, Messages.IncludedBundlesTree_0, SWT.PUSH); fSelectButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fDeselectButton = toolkit.createButton(buttonComp, Messages.IncludedBundlesTree_1, SWT.PUSH); fDeselectButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Label emptySpace = new Label(buttonComp, SWT.NONE); GridData gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING); gd.widthHint = gd.heightHint = 5; emptySpace.setLayoutData(gd); fSelectAllButton = toolkit.createButton(buttonComp, Messages.IncludedBundlesTree_2, SWT.PUSH); fSelectAllButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fDeselectAllButton = toolkit.createButton(buttonComp, Messages.IncludedBundlesTree_3, SWT.PUSH); fDeselectAllButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); emptySpace = new Label(buttonComp, SWT.NONE); gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING); gd.widthHint = gd.heightHint = 5; emptySpace.setLayoutData(gd); fSelectRequiredButton = toolkit.createButton(buttonComp, Messages.TargetContentsGroup_4, SWT.PUSH); fSelectRequiredButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Composite filterComp = toolkit.createComposite(buttonComp); layout = new GridLayout(); layout.marginWidth = layout.marginHeight = 0; filterComp.setLayout(layout); filterComp.setLayoutData(new GridData(SWT.LEFT, SWT.BOTTOM, true, true)); fModeLabel = toolkit.createLabel(filterComp, Messages.TargetContentsGroup_ManageUsing); fPluginModeButton = toolkit.createButton(filterComp, Messages.TargetContentsGroup_PluginMode, SWT.RADIO); fPluginModeButton.setSelection(true); fFeaureModeButton = toolkit.createButton(filterComp, Messages.TargetContentsGroup_FeatureMode, SWT.RADIO); fFeaureModeButton.setSelection(true); emptySpace = new Label(filterComp, SWT.NONE); gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING); gd.widthHint = gd.heightHint = 5; emptySpace.setLayoutData(gd); fShowLabel = toolkit.createLabel(filterComp, Messages.BundleContainerTable_9); fShowPluginsButton = toolkit.createButton(filterComp, Messages.BundleContainerTable_14, SWT.CHECK); fShowPluginsButton.setSelection(true); fShowSourceButton = toolkit.createButton(filterComp, Messages.BundleContainerTable_15, SWT.CHECK); fShowSourceButton.setSelection(true); emptySpace = new Label(filterComp, SWT.NONE); gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING); gd.widthHint = gd.heightHint = 5; emptySpace.setLayoutData(gd); fGroupLabel = toolkit.createLabel(filterComp, Messages.TargetContentsGroup_0); fGroupComboPart = new ComboPart(); fGroupComboPart.createControl(filterComp, toolkit, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY); gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalIndent = 10; fGroupComboPart.getControl().setLayoutData(gd); fGroupComboPart.setItems(new String[] { Messages.TargetContentsGroup_1, Messages.TargetContentsGroup_2, Messages.TargetContentsGroup_3 }); fGroupComboPart.setVisibleItemCount(30); fGroupComboPart.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { handleGroupChange(); } }); fGroupComboPart.select(0); } else { Composite buttonComp = SWTFactory.createComposite(parent, 1, 1, GridData.FILL_VERTICAL, 0, 0); fSelectButton = SWTFactory.createPushButton(buttonComp, Messages.IncludedBundlesTree_0, null); fDeselectButton = SWTFactory.createPushButton(buttonComp, Messages.IncludedBundlesTree_1, null); Label emptySpace = new Label(buttonComp, SWT.NONE); GridData gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING); gd.widthHint = gd.heightHint = 5; emptySpace.setLayoutData(gd); fSelectAllButton = SWTFactory.createPushButton(buttonComp, Messages.IncludedBundlesTree_2, null); fDeselectAllButton = SWTFactory.createPushButton(buttonComp, Messages.IncludedBundlesTree_3, null); emptySpace = new Label(buttonComp, SWT.NONE); gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING); gd.widthHint = gd.heightHint = 5; emptySpace.setLayoutData(gd); fSelectRequiredButton = SWTFactory.createPushButton(buttonComp, Messages.TargetContentsGroup_4, null); Composite filterComp = SWTFactory.createComposite(buttonComp, 1, 1, SWT.NONE, 0, 0); filterComp.setLayoutData(new GridData(SWT.LEFT, SWT.BOTTOM, true, true)); fModeLabel = SWTFactory.createLabel(filterComp, Messages.TargetContentsGroup_ManageUsing, 1); fPluginModeButton = SWTFactory.createRadioButton(filterComp, Messages.TargetContentsGroup_PluginMode); fFeaureModeButton = SWTFactory.createRadioButton(filterComp, Messages.TargetContentsGroup_FeatureMode); emptySpace = new Label(filterComp, SWT.NONE); gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING); gd.widthHint = gd.heightHint = 5; emptySpace.setLayoutData(gd); fShowLabel = SWTFactory.createLabel(filterComp, Messages.BundleContainerTable_9, 1); fShowPluginsButton = SWTFactory.createCheckButton(filterComp, Messages.BundleContainerTable_14, null, true, 1); fShowSourceButton = SWTFactory.createCheckButton(filterComp, Messages.BundleContainerTable_15, null, true, 1); emptySpace = new Label(filterComp, SWT.NONE); gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING); gd.widthHint = gd.heightHint = 5; emptySpace.setLayoutData(gd); fGroupLabel = SWTFactory.createLabel(filterComp, Messages.TargetContentsGroup_0, 1); fGroupCombo = SWTFactory.createCombo(filterComp, SWT.READ_ONLY, 1, new String[] { Messages.TargetContentsGroup_1, Messages.TargetContentsGroup_2, Messages.TargetContentsGroup_3 }); gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalIndent = 10; fGroupCombo.setLayoutData(gd); fGroupCombo.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { handleGroupChange(); } }); fGroupCombo.select(0); } fSelectButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { if (!fTree.getSelection().isEmpty()) { Object[] selected = ((IStructuredSelection) fTree.getSelection()).toArray(); for (int i = 0; i < selected.length; i++) { fTree.setChecked(selected[i], true); } saveIncludedBundleState(); contentChanged(); updateButtons(); fTree.update(fTargetDefinition.getBundleContainers(), new String[] { IBasicPropertyConstants.P_TEXT }); } } }); fDeselectButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { if (!fTree.getSelection().isEmpty()) { Object[] selected = ((IStructuredSelection) fTree.getSelection()).toArray(); for (int i = 0; i < selected.length; i++) { fTree.setChecked(selected[i], false); } saveIncludedBundleState(); contentChanged(); updateButtons(); fTree.update(fTargetDefinition.getBundleContainers(), new String[] { IBasicPropertyConstants.P_TEXT }); } } }); fSelectAllButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { fTree.setAllChecked(true); saveIncludedBundleState(); contentChanged(); updateButtons(); fTree.update(fTargetDefinition.getBundleContainers(), new String[] { IBasicPropertyConstants.P_TEXT }); } }); fDeselectAllButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { fTree.setAllChecked(false); saveIncludedBundleState(); contentChanged(); updateButtons(); fTree.update(fTargetDefinition.getBundleContainers(), new String[] { IBasicPropertyConstants.P_TEXT }); } }); fSelectRequiredButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { Object[] allChecked = fTree.getCheckedLeafElements(); Object[] required = null; if (fFeaureModeButton.getSelection()) { required = getRequiredFeatures(fTargetDefinition.getAllFeatures(), allChecked); } else { required = getRequiredPlugins(fAllBundles, allChecked); } for (int i = 0; i < required.length; i++) { fTree.setChecked(required[i], true); } saveIncludedBundleState(); contentChanged(); updateButtons(); fTree.update(fTargetDefinition.getBundleContainers(), new String[] { IBasicPropertyConstants.P_TEXT }); } }); fPluginModeButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { // Moving from feature based filtering to plug-in based, need to update storage ((TargetDefinition) fTargetDefinition).setUIMode(TargetDefinition.MODE_PLUGIN); contentChanged(); fTargetDefinition.setIncluded(null); fGroupLabel.setEnabled(true); if (fGroupCombo != null) { fGroupCombo.setEnabled(true); } else { fGroupComboPart.getControl().setEnabled(true); } fTree.getControl().setRedraw(false); fTree.refresh(false); fTree.expandAll(); updateCheckState(); updateButtons(); fTree.getControl().setRedraw(true); } }); fPluginModeButton.setSelection(true); GridData gd = new GridData(); gd.horizontalIndent = 10; fPluginModeButton.setLayoutData(gd); fFeaureModeButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { // Moving from plug-in based filtering to feature based, need to update storage ((TargetDefinition) fTargetDefinition).setUIMode(TargetDefinition.MODE_FEATURE); contentChanged(); fTargetDefinition.setIncluded(null); fGroupLabel.setEnabled(false); if (fGroupCombo != null) { fGroupCombo.setEnabled(false); } else { fGroupComboPart.getControl().setEnabled(false); } fTree.getControl().setRedraw(false); fTree.refresh(false); fTree.expandAll(); updateCheckState(); updateButtons(); fTree.getControl().setRedraw(true); } }); fFeaureModeButton.setSelection(false); gd = new GridData(); gd.horizontalIndent = 10; fFeaureModeButton.setLayoutData(gd); fShowPluginsButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { if (!fShowPluginsButton.getSelection()) { fTree.addFilter(fPluginFilter); } else { fTree.removeFilter(fPluginFilter); fTree.expandAll(); updateCheckState(); } updateButtons(); } }); fShowPluginsButton.setSelection(true); gd = new GridData(); gd.horizontalIndent = 10; fShowPluginsButton.setLayoutData(gd); fShowSourceButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { if (!fShowSourceButton.getSelection()) { fTree.addFilter(fSourceFilter); } else { fTree.removeFilter(fSourceFilter); fTree.expandAll(); updateCheckState(); } updateButtons(); } }); fShowSourceButton.setSelection(true); gd = new GridData(); gd.horizontalIndent = 10; fShowSourceButton.setLayoutData(gd); }
From source file:descent.internal.ui.JavaElementProperties.java
License:Open Source License
public Object getPropertyValue(Object name) { if (name.equals(IBasicPropertyConstants.P_TEXT)) { return fSource.getElementName(); }/*from www . ja v a 2 s. com*/ return null; }
From source file:edu.pdx.svl.coDoc.cdt.ui.CElementPropertySource.java
License:Open Source License
/** * @see IPropertySource#getPropertyValue *//*from w ww. j a v a2s . com*/ public Object getPropertyValue(Object name) { if (name.equals(IBasicPropertyConstants.P_TEXT)) { return fCElement.getElementName(); } return null; }
From source file:ext.org.eclipse.jdt.internal.ui.typehierarchy.TypeHierarchyViewPart.java
License:Open Source License
protected void doTypeHierarchyChangedOnViewers(IType[] changedTypes) { if (fHierarchyLifeCycle.getHierarchy() == null || !fHierarchyLifeCycle.getHierarchy().exists()) { clearInput();/* ww w . ja va 2 s. c o m*/ } else { if (changedTypes == null) { // hierarchy change try { fHierarchyLifeCycle.ensureRefreshedTypeHierarchy(fInputElements, getSite().getWorkbenchWindow()); } catch (InvocationTargetException e) { ExceptionHandler.handle(e, getSite().getShell(), TypeHierarchyMessages.TypeHierarchyViewPart_exception_title, TypeHierarchyMessages.TypeHierarchyViewPart_exception_message); clearInput(); return; } catch (InterruptedException e) { return; } fMethodsViewer.refresh(); updateHierarchyViewer(false); } else { // elements in hierarchy modified Object methodViewerInput = fMethodsViewer.getInput(); fMethodsViewer.refresh(); fMethodViewerPaneLabel.setText(fPaneLabelProvider.getText(methodViewerInput)); fMethodViewerPaneLabel.setImage(fPaneLabelProvider.getImage(methodViewerInput)); if (getCurrentViewer().isMethodFiltering()) { if (changedTypes.length == 1) { getCurrentViewer().refresh(changedTypes[0]); } else { updateHierarchyViewer(false); } } else { getCurrentViewer().update(changedTypes, new String[] { IBasicPropertyConstants.P_TEXT, IBasicPropertyConstants.P_IMAGE }); } } } }
From source file:nexcore.tool.uml.ui.core.util.ProjectUtil.java
License:Open Source License
/** * updateParentInExplorer//from w w w.ja v a 2s . c om * * @param target void */ public static void updateParentInExplorer(EObject target) { if (null == target) { return; } CommonViewer commonViewer = ViewerRegistry.getViewer(); if (commonViewer.getControl().isDisposed()) { return; } if (target instanceof DynamicEObjectImpl) { target = UMLUtil.getBaseElement(target); } ITreeNode targetNode = null; EObject parent = UMLManager.getParent((Element) target); targetNode = UMLTreeNodeRegistry.getTreeNode(parent); String[] flags = null; flags = new String[] { IBasicPropertyConstants.P_IMAGE, IBasicPropertyConstants.P_TEXT, IBasicPropertyConstants.P_CHILDREN }; commonViewer.update(targetNode, flags); }
From source file:nexcore.tool.uml.ui.core.util.ProjectUtil.java
License:Open Source License
/** * updateExplorer//from w w w . j a v a 2 s. c om * * @param target * @param childIncluded void */ public static void updateExplorer(EObject target, boolean childIncluded) { if (null == target) { return; } if (target instanceof EAnnotation) { return; } CommonViewer commonViewer = ViewerRegistry.getViewer(); if (commonViewer.getControl().isDisposed()) { return; } if (target instanceof DynamicEObjectImpl) { target = UMLUtil.getBaseElement(target); } ITreeNode targetNode = null; targetNode = UMLTreeNodeRegistry.getTreeNode(target); if (null == targetNode) { return; } String[] flags = null; if (childIncluded) { flags = new String[] { IBasicPropertyConstants.P_IMAGE, IBasicPropertyConstants.P_TEXT, IBasicPropertyConstants.P_CHILDREN }; } else { flags = new String[] { IBasicPropertyConstants.P_IMAGE, IBasicPropertyConstants.P_TEXT }; } try { commonViewer.update(targetNode, flags); commonViewer.refresh(targetNode); } catch (Exception ex) { Log.error(ex); } }
From source file:org.ebayopensource.vjet.eclipse.internal.ui.typehierarchy.VJOTypeHierarchyViewPart.java
License:Open Source License
protected void doTypeHierarchyChangedOnViewers(IType[] changedTypes) { if (fHierarchyLifeCycle.getHierarchy() == null || (!fHierarchyLifeCycle.getHierarchy().exists()) // add by patrick || (!fInputElement.getResource().isAccessible())) { // end add clearInput();/*from w w w . j ava 2s. c om*/ } else { if (changedTypes == null) { // hierarchy change try { fHierarchyLifeCycle.ensureRefreshedTypeHierarchy(fInputElement, getSite().getWorkbenchWindow()); } catch (InvocationTargetException e) { ExceptionHandler.handle(e, getSite().getShell(), TypeHierarchyMessages.TypeHierarchyViewPart_exception_title, TypeHierarchyMessages.TypeHierarchyViewPart_exception_message); clearInput(); return; } catch (InterruptedException e) { return; } fMethodsViewer.refresh(); updateHierarchyViewer(false); } else { // elements in hierarchy modified Object methodViewerInput = fMethodsViewer.getInput(); fMethodsViewer.refresh(); fMethodViewerPaneLabel.setText(fPaneLabelProvider.getText(methodViewerInput)); fMethodViewerPaneLabel.setImage(fPaneLabelProvider.getImage(methodViewerInput)); if (getCurrentViewer().isMethodFiltering()) { if (changedTypes.length == 1) { getCurrentViewer().refresh(changedTypes[0]); } else { updateHierarchyViewer(false); } } else { getCurrentViewer().update(changedTypes, new String[] { IBasicPropertyConstants.P_TEXT, IBasicPropertyConstants.P_IMAGE }); } } } }
From source file:org.eclipse.cdt.cpp.ui.internal.views.targets.BaseElement.java
License:Open Source License
/** * Hook implementation as part of IPropertySource, it defines * 1) P_NAME returns String, name of this element * this property keys are defined in IBasicPropertyConstants * * @param propKey java.lang.Object// w ww . j av a2 s . c o m * @return java.lang.Object associated property */ public Object getPropertyValue(Object propKey) { if (((String) propKey).equals(IBasicPropertyConstants.P_TEXT)) return getName(); return null; }