private void configureWorkspaceSettings() { String preferenceNodeId = this.getPreferenceNodeId(); IPreferencePage preferencePage = newPreferencePage(); final IPreferenceNode preferenceNode = new PreferenceNode(preferenceNodeId, preferencePage); PreferenceManager manager = new PreferenceManager(); manager.addToRoot(preferenceNode); final PreferenceDialog dialog = new PreferenceDialog(this.getControl().getShell(), manager); BusyIndicator.showWhile(this.getControl().getDisplay(), new Runnable() { @Override public void run() { dialog.create(); dialog.setMessage(preferenceNode.getLabelText()); dialog.open(); } }); }
@Override public void createPage() { // create the page via DI using the OSGi service context try { IPreferencePage page = ContextInjectionFactory.make(this.pageClass, this.context); setPage(page); if (getLabelImage() != null) { getPage().setImageDescriptor(getImageDescriptor()); } getPage().setTitle(getLabelText()); ((PreferencePage) getPage()).setPreferenceStore(this.store); } catch (Exception e) { if (this.logger != null) { this.logger.log( LogService.LOG_ERROR, "Error on creating instance of " + this.pageClass.getName(), e); } } }
/** * Show a single preference pages * * @param id * - the preference page identification * @param page * - the preference page */ protected void showPreferencePage(String id, IPreferencePage page, final IProject project) { final IPreferenceNode targetNode = new PreferenceNode(id, page); PreferenceManager manager = new PreferenceManager(); manager.addToRoot(targetNode); Shell shell = getControl().getShell(); final PreferenceDialog dialog = project == null ? new PreferenceDialog(shell, manager) : new PropertyDialog(shell, manager, new StructuredSelection(project)); BusyIndicator.showWhile(getControl().getDisplay(), new Runnable() { public void run() { dialog.create(); dialog.setMessage(targetNode.getLabelText()); dialog.open(); } }); }
@Override protected void handleSave() { final Iterator<IPreferenceNode> nodes = getPreferenceManager().getElements(PreferenceManager.PRE_ORDER).iterator(); while (nodes.hasNext()) { final IPreferenceNode node = nodes.next(); final IPreferencePage page = node.getPage(); if (page instanceof PreferencePage) { final IPreferenceStore store = ((PreferencePage) page).getPreferenceStore(); if (store != null && store.needsSaving() && store instanceof IPersistentPreferenceStore) { try { ((IPersistentPreferenceStore) store).save(); } catch (final IOException ioe) { final String message = JFaceMessages.get("err.preferences.save"); logger.log(Level.SEVERE, message, ioe); EnhancedErrorDialog.openError(getShell(), title, message, IStatus.ERROR, ioe, new Image[] { Display.getCurrent().getSystemImage(SWT.ICON_ERROR) }); } } } } }
/** * This method allows us to open the preference dialog on the specific page, in this case the perspective page * * @param id * the id of pref page to show * @param page * the actual page to show Copied from org.eclipse.debug.internal.ui.SWTUtil */ 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(UIUtils.getActiveShell(), manager); BusyIndicator.showWhile(getStandardDisplay(), new Runnable() { public void run() { dialog.create(); dialog.setMessage(targetNode.getLabelText()); dialog.open(); } }); }
/** * Show a single preference pages * * @param id * - the preference page identification * @param page * - the preference page */ protected 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(getControl() .getShell(), manager); BusyIndicator.showWhile(getControl().getDisplay(), new Runnable() { public void run() { dialog.create(); dialog.setMessage(targetNode.getLabelText()); dialog.open(); } }); }
public ContributedPreferenceNode( String id, String label, ImageDescriptor imageDescriptor, Class<? extends IPreferencePage> pageClass, String path, String nodeQualifier) { super(id, label, imageDescriptor, pageClass.getName()); this.path = path; this.pageClass = pageClass; this.nodeQualifier = nodeQualifier != null ? nodeQualifier : FrameworkUtil.getBundle(pageClass).getSymbolicName(); }
public PreferenceNodeContribution( String id, String label, ImageDescriptor imageDescriptor, Class<? extends IPreferencePage> pageClass, String path, String nodeQualifier) { this.nodes.add(new ContributedPreferenceNode(id, label, imageDescriptor, pageClass, path, nodeQualifier)); }
public void addPreferenceNode( String id, String label, ImageDescriptor imageDescriptor, Class<? extends IPreferencePage> pageClass, String path, String nodeQualifier) { this.nodes.add(new ContributedPreferenceNode(id, label, imageDescriptor, pageClass, path, nodeQualifier)); }
/** * Show a single preference pages * @param id - the preference page identification * @param page - the preference page */ protected 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(getControl().getShell(), manager); BusyIndicator.showWhile(getControl().getDisplay(), new Runnable() { public void run() { dialog.create(); dialog.setMessage(targetNode.getLabelText()); dialog.open(); } }); }
/** * Show a single preference pages * * @param id * - the preference page identification * @param page * - the preference page */ protected 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(getControl().getShell(), manager); BusyIndicator.showWhile(getControl().getDisplay(), new Runnable() { public void run() { dialog.create(); dialog.setMessage(targetNode.getLabelText()); dialog.open(); } }); }
@Override protected boolean showPage(final IPreferenceNode node) { boolean success = super.showPage(node); final IPreferencePage currentPage = getCurrentPage(); if (currentPage instanceof BasePreferencePage) { ((BasePreferencePage) currentPage).updateCrossChildrenStatus(); } return success; }
protected 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(getControl().getShell(), manager); BusyIndicator.showWhile(getControl().getDisplay(), new Runnable() { public void run() { dialog.create(); dialog.setMessage(targetNode.getLabelText()); dialog.open(); } }); }
/** * Creates a new preferences page and opens it */ public void configureWorkspaceSettings() { // create a new instance of the current class IPreferencePage page = new CppStylePerfPage(); page.setTitle(getTitle()); // and show it showPreferencePage(CppStyleConstants.PerfPageId, page); }
/** * Updates the message. * * @see org.eclipse.jface.preference.IPreferencePageContainer#updateMessage() */ public void updateMessage() { String message = null; String errorMessage = null; boolean showingError = false; IPreferencePage currentPage = this.getCurrentPage(); if (currentPage != null) { message = currentPage.getMessage(); errorMessage = currentPage.getErrorMessage(); } int messageType = IMessageProvider.NONE; if (message != null && currentPage instanceof IMessageProvider) { messageType = ((IMessageProvider) currentPage).getMessageType(); } if (errorMessage == null) { if (showingError) { // we were previously showing an error showingError = false; } } else { message = errorMessage; messageType = IMessageProvider.ERROR; if (!showingError) { // we were not previously showing an error showingError = true; } } this.messageArea.updateText(message, messageType); }
/** * Updates the title. * * @see org.eclipse.jface.preference.IPreferencePageContainer#updateTitle() */ public void updateTitle() { IPreferencePage currentPage = this.getCurrentPage(); if (currentPage == null) { return; } this.messageArea.showTitle(currentPage.getTitle(), currentPage .getImage()); }
static void showConfigDialog() { IWorkbenchWindow window = EFActivator.getDefault().getWorkbench().getActiveWorkbenchWindow(); IPreferencePage page = new EFPreferencePage(); PreferenceManager mgr = window.getWorkbench().getPreferenceManager(); Shell shell = EFActivator.getDefault().getWorkbench().getDisplay().getActiveShell(); PreferenceDialog dialog = new PreferenceDialog(shell, mgr); dialog.setSelectedNode("Externalfilter.preferences.ExternalFilterPreferencePage"); dialog.create(); dialog.setMessage(page.getTitle()); dialog.open(); }
public FileCommPartnerComposite(IPreferencePage preferencePage, ScrolledComposite scrolledComposite, Composite editorParent, FileCommPartner fileCommPartner){ super(editorParent, SWT.BORDER); this.preferencePage = preferencePage; this.fileCommPartner = fileCommPartner; createElements(); this.scrolledComposite = scrolledComposite; refreshParent(getParent()); }
public PreferenceNodeContribution(String id, String label, Class<? extends IPreferencePage> pageClass) { this(id, label, null, pageClass, null, null); }
public PreferenceNodeContribution(String id, String label, Class<? extends IPreferencePage> pageClass, String path) { this(id, label, null, pageClass, path, null); }
public PreferenceNodeContribution(String id, String label, Class<? extends IPreferencePage> pageClass, String path, String nodeQualifier) { this(id, label, null, pageClass, path, nodeQualifier); }
public void addPreferenceNode(String id, String label, Class<? extends IPreferencePage> pageClass) { addPreferenceNode(id, label, null, pageClass, null, null); }
public void addPreferenceNode(String id, String label, Class<? extends IPreferencePage> pageClass, String path) { addPreferenceNode(id, label, null, pageClass, path, null); }
public void addPreferenceNode(String id, String label, Class<? extends IPreferencePage> pageClass, String path, String nodeQualifier) { addPreferenceNode(id, label, null, pageClass, path, nodeQualifier); }
/** * Create a new ContributedPreferenceNode. * * @param id * the node id * @param label * the label used to display the node in the preference dialog's * tree * @param imageDescriptor * the image displayed left of the label in the preference * dialog's tree, or null if none * @param pageClass * the preference page implementation, this class must implement * {@link IPreferencePage} * @param path * the path of the node to which the contributed node should be * added to * @param nodeQualifier * the qualifier used to look up the preference node */ public ContributedPreferenceNode( String id, String label, ImageDescriptor imageDescriptor, Class<? extends IPreferencePage> pageClass, String path, String nodeQualifier) { super(id, label, imageDescriptor, pageClass.getName()); this.path = path; this.pageClass = pageClass; this.nodeQualifier = (nodeQualifier != null) ? nodeQualifier : FrameworkUtil.getBundle(pageClass).getSymbolicName(); this.context = EclipseContextFactory.getServiceContext( FrameworkUtil.getBundle(pageClass).getBundleContext()); this.logger = context.get(LogService.class); }
/** * Creates a {@link PreferenceNodeContribution} with the given settings. * * @param id * the node id * @param label * the label used to display the node in the preference dialog's * tree * @param imageDescriptor * the image displayed left of the label in the preference * dialog's tree, or null if none * @param pageClass * the preference page implementation, this class must implement * {@link IPreferencePage} * @param path * the path of the node to which the contributed node should be * added to * @param nodeQualifier * the qualifier used to look up the preference node */ public PreferenceNodeContribution( String id, String label, ImageDescriptor imageDescriptor, Class<? extends IPreferencePage> pageClass, String path, String nodeQualifier) { this.nodes.add(new ContributedPreferenceNode( id, label, imageDescriptor, pageClass, path, nodeQualifier)); }
/** * Adds a {@link PreferenceNodeContribution} with the given settings. * * @param id * the node id * @param label * the label used to display the node in the preference dialog's * tree * @param imageDescriptor * the image displayed left of the label in the preference * dialog's tree, or null if none * @param pageClass * the preference page implementation, this class must implement * {@link IPreferencePage} * @param path * the path of the node to which the contributed node should be * added to * @param nodeQualifier * the qualifier used to look up the preference node */ public void addPreferenceNode( String id, String label, ImageDescriptor imageDescriptor, Class<? extends IPreferencePage> pageClass, String path, String nodeQualifier) { this.nodes.add(new ContributedPreferenceNode( id, label, imageDescriptor, pageClass, path, nodeQualifier)); }
public StylePreferenceNode( String id, IPreferencePage preferencePage ) { super( id, preferencePage ); }
/** * Creates the <code>PreferencePage</code> according to the settings in * this <code>ExtendedPreferenceNode</code>. */ public void createPage() { setPage((IPreferencePage) this.createObject(this.classname)); getPage().setTitle(this.getLabelText()); }
/** * Creates a {@link PreferenceNodeContribution} with the given settings. * Will set the imageDescriptor, the path and the nodeQualifier setting * to <code>null</code>. * * @param id * the node id * @param label * the label used to display the node in the preference dialog's * tree * @param pageClass * the preference page implementation, this class must implement * {@link IPreferencePage} */ public PreferenceNodeContribution( String id, String label, Class<? extends IPreferencePage> pageClass) { this(id, label, null, pageClass, null, null); }
/** * Creates a {@link PreferenceNodeContribution} with the given settings. * Will set the imageDescriptor and the nodeQualifier setting to * <code>null</code>. * * @param id * the node id * @param label * the label used to display the node in the preference dialog's * tree * @param pageClass * the preference page implementation, this class must implement * {@link IPreferencePage} * @param path * the path of the node to which the contributed node should be * added to */ public PreferenceNodeContribution( String id, String label, Class<? extends IPreferencePage> pageClass, String path) { this(id, label, null, pageClass, path, null); }
/** * Creates a {@link PreferenceNodeContribution} with the given settings. * Will set the imageDescriptor setting to <code>null</code>. * * @param id * the node id * @param label * the label used to display the node in the preference dialog's * tree * @param pageClass * the preference page implementation, this class must implement * {@link IPreferencePage} * @param path * the path of the node to which the contributed node should be * added to * @param nodeQualifier * the qualifier used to look up the preference node */ public PreferenceNodeContribution( String id, String label, Class<? extends IPreferencePage> pageClass, String path, String nodeQualifier) { this(id, label, null, pageClass, path, nodeQualifier); }
/** * Adds a {@link PreferenceNodeContribution} with the given settings. * Will set the imageDescriptor, the path and the nodeQualifier setting * to <code>null</code>. * * @param id * the node id * @param label * the label used to display the node in the preference dialog's * tree * @param pageClass * the preference page implementation, this class must implement * {@link IPreferencePage} */ public void addPreferenceNode( String id, String label, Class<? extends IPreferencePage> pageClass) { addPreferenceNode(id, label, null, pageClass, null, null); }
/** * Adds a {@link PreferenceNodeContribution} with the given settings. Will * set the imageDescriptor and the nodeQualifier setting to * <code>null</code>. * * @param id * the node id * @param label * the label used to display the node in the preference dialog's * tree * @param pageClass * the preference page implementation, this class must implement * {@link IPreferencePage} * @param path * the path of the node to which the contributed node should be * added to */ public void addPreferenceNode( String id, String label, Class<? extends IPreferencePage> pageClass, String path) { addPreferenceNode(id, label, null, pageClass, path, null); }
/** * Adds a {@link PreferenceNodeContribution} with the given settings. * Will set the imageDescriptor setting to <code>null</code>. * * @param id * the node id * @param label * the label used to display the node in the preference dialog's * tree * @param pageClass * the preference page implementation, this class must implement * {@link IPreferencePage} * @param path * the path of the node to which the contributed node should be * added to * @param nodeQualifier * the qualifier used to look up the preference node */ public void addPreferenceNode( String id, String label, Class<? extends IPreferencePage> pageClass, String path, String nodeQualifier) { addPreferenceNode(id, label, null, pageClass, path, nodeQualifier); }
/** * Creates an <code>ExtendedPreferenceNode</code> with the given id and * preference page. The title of the preference page is used for the node * label. The node will not have an image. * * @param id the node id * @param preferencePage the preference page */ public ExtendedPreferenceNode(String id, IPreferencePage preferencePage) { super(id, preferencePage); }