/** * Sets the root entry for this property sheet viewer. The root entry is not * visible in the viewer. * * @param root * the root entry */ public void setRootEntry(IPropertySheetEntry root) { // If we have a root entry, remove our entry listener if (rootEntry != null) { rootEntry.removePropertySheetEntryListener(entryListener); } rootEntry = root; // Set the root as user data on the tree tree.setData(rootEntry); // Add an IPropertySheetEntryListener to listen for entry change // notifications rootEntry.addPropertySheetEntryListener(entryListener); // Pass our input to the root, this will trigger entry change // callbacks to update this viewer setInput(input); }
/** * The user is attempting to drag. Add the appropriate * data to the event. * @param event The event sent from the drag and drop support. */ void performDragSetData(DragSourceEvent event) { // Get the selected property IStructuredSelection selection = (IStructuredSelection) viewer .getSelection(); if (selection.isEmpty()) { return; } // Assume single selection IPropertySheetEntry entry = (IPropertySheetEntry) selection .getFirstElement(); // Place text as the data StringBuffer buffer = new StringBuffer(); buffer.append(entry.getDisplayName()); buffer.append("\t"); //$NON-NLS-1$ buffer.append(entry.getValueAsString()); event.data = buffer.toString(); }
public void errorMessageChanged(IPropertySheetEntry entry) { // update the error message setErrorMessage(entry.getErrorText()); } };
/** * Update the given entry (but not its children or parent) * * @param entry * the entry we will update * @param item * the tree item for the given entry */ private void updateEntry(IPropertySheetEntry entry, TreeItem item) { // ensure that backpointer is correct item.setData(entry); // update the map accordingly entryToItemMap.put(entry, item); // update the name and value columns item.setText(0, entry.getDisplayName()); item.setText(1, entry.getValueAsString()); Image image = entry.getImage(); if (item.getImage(1) != image) { item.setImage(1, image); } // update the "+" icon updatePlus(entry, item); }
List<IPropertySheetEntry> childEntries = getFilteredEntries(rootEntry.getChildEntries()); String categoryName = childEntry.getCategory(); if (categoryName == null) { misc.addEntry(childEntry); IPropertySheetEntry childEntry = childEntries .get(i); String categoryName = childEntry.getCategory(); if (categoryName != null && !seen.contains(categoryName)) { seen.add(categoryName);
((IPropertySheetEntry) entriesToDispose.get(i)).dispose();
/** * Asks the entry currently being edited to apply its current cell editor * value. */ private void applyEditorValue() { TreeItem treeItem = treeEditor.getItem(); // treeItem can be null when view is opened if (treeItem == null || treeItem.isDisposed()) { return; } IPropertySheetEntry entry = (IPropertySheetEntry) treeItem.getData(); entry.applyEditorValue(); }
/** * Returns the child entries of the given entry * @param entry The entry to search * * @return the children of the given entry (element type * <code>IPropertySheetEntry</code>) */ private List getChildren(IPropertySheetEntry entry) { // if the entry is the root and we are showing categories, and we have // more than the // defualt category, return the categories if (entry == rootEntry && isShowingCategories) { if (categories.length > 1 || (categories.length == 1 && !categories[0] .getCategoryName().equals( MISCELLANEOUS_CATEGORY_NAME))) { return Arrays.asList(categories); } } // return the sorted & filtered child entries return getSortedEntries(getFilteredEntries(entry.getChildEntries())); }
/** * Returns a negative, zero, or positive number depending on whether the * first element is less than, equal to, or greater than the second element. * <p> * The default implementation of this method uses the collator to * compare the display names. Subclasses may override. * </p> * * @param entryA * the first element * @param entryB * the second element * @return a negative number if the first element is less than the second * element; the value <code>0</code> if the first element is equal * to the second element; and a positive number if the first element * is greater than the second element */ public int compare(IPropertySheetEntry entryA, IPropertySheetEntry entryB) { return getCollator().compare(entryA.getDisplayName(), entryB.getDisplayName()); }
/** * Selection in the viewer occurred. Check if there is an active cell * editor. If yes, deactivate it and check if a new cell editor must be * activated. * * @param selection * the TreeItem that is selected */ private void handleSelect(TreeItem selection) { // deactivate the current cell editor if (cellEditor != null) { applyEditorValue(); deactivateCellEditor(); } if (selection == null) { setMessage(null); setErrorMessage(null); } else { Object object = selection.getData(); if (object instanceof IPropertySheetEntry) { // get the entry for this item IPropertySheetEntry activeEntry = (IPropertySheetEntry) object; // display the description for the item setMessage(activeEntry.getDescription()); // activate a cell editor on the selection activateCellEditor(selection); } } entrySelectionChanged(); }
for (IPropertySheetEntry entry : entries) { if (entry != null) { String[] filters = entry.getFilters(); boolean expert = false; if (filters != null) {
cellEditor = activeEntry.getEditor(tree);
((IPropertySheetEntry) node).addPropertySheetEntryListener(entryListener);
item.setText(0, entry.getDisplayName()); item.setText(1, entry.getValueAsString()); Image image = entry.getImage(); if (item.getImage(1) != image) { item.setImage(1, image);
List childEntries = getFilteredEntries(rootEntry.getChildEntries()); IPropertySheetEntry childEntry = (IPropertySheetEntry) childEntries .get(i); String categoryName = childEntry.getCategory(); if (categoryName == null) { misc.addEntry(childEntry); IPropertySheetEntry childEntry = (IPropertySheetEntry) childEntries .get(i); String categoryName = childEntry.getCategory(); if (categoryName != null && !seen.contains(categoryName)) { seen.add(categoryName);
((IPropertySheetEntry) entriesToDispose.get(i)).dispose();
/** * Asks the entry currently being edited to apply its current cell editor * value. */ private void applyEditorValue() { TreeItem treeItem = treeEditor.getItem(); // treeItem can be null when view is opened if (treeItem == null || treeItem.isDisposed()) { return; } IPropertySheetEntry entry = (IPropertySheetEntry) treeItem.getData(); entry.applyEditorValue(); }
/** * Returns the child entries of the given entry * @param entry The entry to search * * @return the children of the given entry (element type * <code>IPropertySheetEntry</code>) */ private List<?> getChildren(IPropertySheetEntry entry) { // if the entry is the root and we are showing categories, and we have // more than the // defualt category, return the categories if (entry == rootEntry && isShowingCategories) { if (categories.length > 1 || (categories.length == 1 && !categories[0] .getCategoryName().equals( MISCELLANEOUS_CATEGORY_NAME))) { return Arrays.asList(categories); } } // return the sorted & filtered child entries return getSortedEntries(getFilteredEntries(entry.getChildEntries())); }
/** * Returns a negative, zero, or positive number depending on whether the * first element is less than, equal to, or greater than the second element. * <p> * The default implementation of this method uses the collator to * compare the display names. Subclasses may override. * </p> * * @param entryA * the first element * @param entryB * the second element * @return a negative number if the first element is less than the second * element; the value <code>0</code> if the first element is equal * to the second element; and a positive number if the first element * is greater than the second element */ public int compare(IPropertySheetEntry entryA, IPropertySheetEntry entryB) { return getCollator().compare(entryA.getDisplayName(), entryB.getDisplayName()); }
/** * Selection in the viewer occurred. Check if there is an active cell * editor. If yes, deactivate it and check if a new cell editor must be * activated. * * @param selection * the TreeItem that is selected */ private void handleSelect(TreeItem selection) { // deactivate the current cell editor if (cellEditor != null) { applyEditorValue(); deactivateCellEditor(); } if (selection == null) { setMessage(null); setErrorMessage(null); } else { Object object = selection.getData(); if (object instanceof IPropertySheetEntry) { // get the entry for this item IPropertySheetEntry activeEntry = (IPropertySheetEntry) object; // display the description for the item setMessage(activeEntry.getDescription()); // activate a cell editor on the selection activateCellEditor(selection); } } entrySelectionChanged(); }