/** * @param parentShell * @param manager */ public StyleDialog(Shell parentShell, PreferenceManager manager, IDOMElement element, CSSPropertyContext style) { super(parentShell, manager); manager.addToRoot(new TextPreferenceNode(element, style)); manager.addToRoot(new BackgroudPreferenceNode(element, style)); manager.addToRoot(new BlockPreferenceNode(element, style)); manager.addToRoot(new BoxPreferenceNode(element, style)); manager.addToRoot(new BorderPreferenceNode(element, style)); manager.addToRoot(new ListPreferenceNode(element, style)); manager.addToRoot(new PositioningPreferenceNode(element, style)); manager.addToRoot(new ExtensionsPreferenceNode(element, style)); }
@Override public void run() throws Exception { List<IPreferenceNode> nodes = preferenceManager.getElements(PreferenceManager.PRE_ORDER); for (int i = 0; i < nodes.size(); i++) { IPreferenceNode node = nodes.get(i); node.disposeResources(); } }
/** * Returns all preference nodes managed by this * manager. * * @param order the traversal order, one of * <code>PRE_ORDER</code> and <code>POST_ORDER</code> * @return a list of preference nodes * (element type: <code>IPreferenceNode</code>) * in the given order */ public List<IPreferenceNode> getElements(int order) { Assert.isTrue(order == PRE_ORDER || order == POST_ORDER, "invalid traversal order");//$NON-NLS-1$ ArrayList<IPreferenceNode> sequence = new ArrayList<>(); IPreferenceNode[] subnodes = getRoot().getSubNodes(); for (int i = 0; i < subnodes.length; i++) { buildSequence(subnodes[i], sequence, order); } return sequence; }
private boolean showPreferencePage(final IPreferenceNode targetNode, Shell shell) { PreferenceManager manager = new PreferenceManager(); manager.addToRoot(targetNode); final PreferenceDialog dialog = new PreferenceDialog(shell, manager); final boolean[] result = new boolean[] {false}; BusyIndicator.showWhile(shell.getDisplay(), () -> { dialog.create(); dialog.setMessage(targetNode.getLabelText()); if (dialog.open() == Window.OK) result[0] = true; }); return result[0]; }
PreferenceManager preferenceManager = new PreferenceManager(); for (PropertySection section : sections) { List<IPreferenceNode> subNodes = new ArrayList<>(); preferenceManager.addToRoot(preferenceNode); preferenceManager.addTo(section.getName(), subNode);
protected Object openDialogBox(Control cellEditorWindow) { ICSSStyleDeclaration styleDeclaration = (ICSSStyleDeclaration) ((ElementCSSInlineStyle) _element) .getStyle(); PreferenceManager manager = new PreferenceManager(); Shell shell = cellEditorWindow.getShell(); CSSPropertyContext context = new CSSPropertyContext(styleDeclaration); StyleDialog dialog = new StyleDialog(shell, manager, _element, context); if (dialog.open() == Window.OK) { if (context.isModified()) { ChangeStyleCommand c = new ChangeStyleCommand(_element, context); c.execute(); } } String style = (_element == null ? null : _element .getAttribute(IJSFConstants.ATTR_STYLE)); return style == null ? "" : style; } }
IPreferenceNode node = findNodeMatching(getSelectedNodePreference()); if (node == null) { IPreferenceNode[] nodes = preferenceManager.getRootSubNodes(); ViewerComparator comparator = getTreeViewer().getComparator(); if (comparator != null) { .getRoot(), selectedNode)) { selectedNode = null; break;
@Override public Object getParent(Object element) {//must be an instance of <code>IPreferenceNode</code>. IPreferenceNode targetNode = (IPreferenceNode) element; IPreferenceNode root = manager.getRoot(); return findParent(root, targetNode); }
/** * Finds and returns the contribution node at the given path. * * @param path the path * @return the node, or <code>null</code> if none */ public IPreferenceNode find(String path) { return find(path,root); }
@Override public QuickAccessElement[] getElements() { if (cachedElements == null) { List<PreferenceElement> list = new ArrayList<>(); collectElements("", PlatformUI.getWorkbench().getPreferenceManager().getRootSubNodes(), list); //$NON-NLS-1$ cachedElements = new PreferenceElement[list.size()]; for (int i = 0; i < list.size(); i++) { PreferenceElement preferenceElement = list.get(i); cachedElements[i] = preferenceElement; idToElement.put(preferenceElement.getId(), preferenceElement); } } return cachedElements; }
/** * Recursively enumerates all nodes at or below the given node * and adds them to the given list in the given order. * * @param node the starting node * @param sequence a read-write list of preference nodes * (element type: <code>IPreferenceNode</code>) * in the given order * @param order the traversal order, one of * <code>PRE_ORDER</code> and <code>POST_ORDER</code> */ protected void buildSequence(IPreferenceNode node, List<IPreferenceNode> sequence, int order) { if (order == PRE_ORDER) { sequence.add(node); } IPreferenceNode[] subnodes = node.getSubNodes(); for (IPreferenceNode subnode : subnodes) { buildSequence(subnode, sequence, order); } if (order == POST_ORDER) { sequence.add(node); } }
/** * Displays the given preference page. * * @param id pref page id * @param page pref page * @deprecated use <code>JDIDebugUIPlugin#showPreferencePage(String pageId)</code>, which uses the <code>PreferenceUtils</code> framework for opening pages. */ public static void showPreferencePage(String id, IPreferencePage page) { final IPreferenceNode targetNode = new PreferenceNode(id, page); PreferenceManager manager = new PreferenceManager(); manager.addToRoot(targetNode); final PreferenceDialog dialog = new PreferenceDialog(JDIDebugUIPlugin.getActiveWorkbenchShell(), manager); final boolean [] result = new boolean[] { false }; BusyIndicator.showWhile(JDIDebugUIPlugin.getStandardDisplay(), new Runnable() { public void run() { dialog.create(); dialog.setMessage(targetNode.getLabelText()); result[0]= (dialog.open() == Window.OK); } }); }
public void run() { ICSSStyleDeclaration styleDeclaration = (ICSSStyleDeclaration) ((ElementCSSInlineStyle) this._element) .getStyle(); PreferenceManager manager = new PreferenceManager(); EditPartViewer viewer = this._editPart.getViewer(); Shell shell = viewer.getControl().getShell(); CSSPropertyContext context = new CSSPropertyContext(styleDeclaration); StyleDialog dialog = new StyleDialog(shell, manager, _element, context); if (dialog.open() == Window.OK) { if (context.isModified()) { ChangeStyleCommand c = new ChangeStyleCommand(_element, context); c.execute(); } } } }
IPreferenceNode node = findNodeMatching(getSelectedNodePreference()); if (node == null) { IPreferenceNode[] nodes = preferenceManager.getRootSubNodes(); ViewerComparator comparator = getTreeViewer().getComparator(); if (comparator != null) { if (!filters[j].select(this.treeViewer, preferenceManager.getRoot(), selectedNode)) { selectedNode = null; break;
/** * Returns the root level nodes of this preference manager. * * @return an array containing the root nodes * @since 1.0 */ public final IPreferenceNode[] getRootSubNodes() { return getRoot().getSubNodes(); }
/** * Finds and returns the contribution node at the given path. * * @param path the path * @return the node, or <code>null</code> if none */ public IPreferenceNode find(String path) { return find(path,root); }
@Override public Map getParameterValues() { if (preferenceMap == null) { preferenceMap = new TreeMap(); final PreferenceManager preferenceManager = PlatformUI .getWorkbench().getPreferenceManager(); collectParameterValues(preferenceMap, preferenceManager .getRootSubNodes(), null); } return preferenceMap; }
/** * Recursively enumerates all nodes at or below the given node * and adds them to the given list in the given order. * * @param node the starting node * @param sequence a read-write list of preference nodes * (element type: <code>IPreferenceNode</code>) * in the given order * @param order the traversal order, one of * <code>PRE_ORDER</code> and <code>POST_ORDER</code> */ protected void buildSequence(IPreferenceNode node, List sequence, int order) { if (order == PRE_ORDER) { sequence.add(node); } IPreferenceNode[] subnodes = node.getSubNodes(); for (int i = 0; i < subnodes.length; i++) { buildSequence(subnodes[i], sequence, order); } if (order == POST_ORDER) { sequence.add(node); } }
@Override public void run(IAction action) { PreferenceManager prefManager = new PreferenceManager(); ResetMemoryBlockPreferencePage page = new ResetMemoryBlockPreferencePage(); IPreferenceNode node = new PreferenceNode("org.eclipse.debug.ui.memory.resetMemoryBlock", page); //$NON-NLS-1$ prefManager.addToRoot(node); SetPaddedStringPreferencePage page2 = new SetPaddedStringPreferencePage(); IPreferenceNode node2 = new PreferenceNode("org.eclipse.debug.ui.memory.setPaddedString", page2); //$NON-NLS-1$ prefManager.addToRoot(node2); CodePagesPreferencePage page3 = new CodePagesPreferencePage(); IPreferenceNode node3 = new PreferenceNode("org.eclipse.debug.ui.memory.codePages", page3); //$NON-NLS-1$ prefManager.addToRoot(node3); final PreferenceDialog dialog = new PreferenceDialog(DebugUIPlugin.getShell(), prefManager); BusyIndicator.showWhile(DebugUIPlugin.getStandardDisplay(), () -> { dialog.create(); dialog.open(); }); }
public void run() throws Exception { List nodes = preferenceManager.getElements(PreferenceManager.PRE_ORDER); for (int i = 0; i < nodes.size(); i++) { IPreferenceNode node = (IPreferenceNode) nodes.get(i); node.disposeResources(); } }