X-Git-Url: http://git.phpeclipse.com diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/overlaypages/OverlayPage.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/overlaypages/OverlayPage.java index a501786..50ecf07 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/overlaypages/OverlayPage.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/overlaypages/OverlayPage.java @@ -39,16 +39,19 @@ import org.eclipse.ui.part.PageBook; */ public abstract class OverlayPage extends PropertyPage { - /*** Name of resource property for the selection of workbench or project settings ***/ + /** + * * Name of resource property for the selection of workbench or project + * settings ** + */ public static final String USEPROJECTSETTINGS = "useProjectSettings"; //$NON-NLS-1$ - + private static final String FALSE = "false"; //$NON-NLS-1$ + private static final String TRUE = "true"; //$NON-NLS-1$ // Additional buttons for property pages - private Button useWorkspaceSettingsButton, - useProjectSettingsButton, - configureButton; + private Button useWorkspaceSettingsButton, useProjectSettingsButton, + configureButton; // Overlay preference store for property pages private PropertyStore overlayStore; @@ -71,7 +74,9 @@ public abstract class OverlayPage extends PropertyPage { /** * Constructor - * @param title - title string + * + * @param title - + * title string */ public OverlayPage(String title) { super(); @@ -80,8 +85,11 @@ public abstract class OverlayPage extends PropertyPage { /** * Constructor - * @param title - title string - * @param image - title image + * + * @param title - + * title string + * @param image - + * title image */ public OverlayPage(String title, ImageDescriptor image) { super(); @@ -92,7 +100,7 @@ public abstract class OverlayPage extends PropertyPage { /** * Returns the id of the current preference page as defined in plugin.xml - * Subclasses must implement. + * Subclasses must implement. * * @return - the qualifier */ @@ -100,6 +108,7 @@ public abstract class OverlayPage extends PropertyPage { /** * Returns true if this instance represents a property page + * * @return - true for property pages, false for preference pages */ public boolean isPropertyPage() { @@ -107,9 +116,10 @@ public abstract class OverlayPage extends PropertyPage { } /** - * We need to implement createContents method. In case of property pages we insert two radio buttons - * and a push button at the top of the page. Below this group we create a new composite for the contents - * created by subclasses. + * We need to implement createContents method. In case of property pages we + * insert two radio buttons and a push button at the top of the page. Below + * this group we create a new composite for the contents created by + * subclasses. * * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite) */ @@ -126,8 +136,11 @@ public abstract class OverlayPage extends PropertyPage { } /** - * Creates and initializes a selection group with two choice buttons and one push button. - * @param parent - the parent composite + * Creates and initializes a selection group with two choice buttons and one + * push button. + * + * @param parent - + * the parent composite */ private void createSelectionGroup(Composite parent) { Composite comp = new Composite(parent, SWT.NONE); @@ -139,10 +152,13 @@ public abstract class OverlayPage extends PropertyPage { Composite radioGroup = new Composite(comp, SWT.NONE); radioGroup.setLayout(new GridLayout()); radioGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - useWorkspaceSettingsButton = createRadioButton(radioGroup, Messages.getString("OverlayPage.Use_Workspace_Settings")); //$NON-NLS-1$ - useProjectSettingsButton = createRadioButton(radioGroup, Messages.getString("OverlayPage.Use_Project_Settings")); //$NON-NLS-1$ + useWorkspaceSettingsButton = createRadioButton(radioGroup, Messages + .getString("OverlayPage.Use_Workspace_Settings")); //$NON-NLS-1$ + useProjectSettingsButton = createRadioButton(radioGroup, Messages + .getString("OverlayPage.Use_Project_Settings")); //$NON-NLS-1$ configureButton = new Button(comp, SWT.PUSH); - configureButton.setText(Messages.getString("OverlayPage.Configure_Workspace_Settings")); //$NON-NLS-1$ + configureButton.setText(Messages + .getString("OverlayPage.Configure_Workspace_Settings")); //$NON-NLS-1$ configureButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { configureWorkspaceSettings(); @@ -150,9 +166,9 @@ public abstract class OverlayPage extends PropertyPage { }); // Set workspace/project radio buttons try { - String use = - ((IResource) getElement()).getPersistentProperty( - new QualifiedName(pageId, USEPROJECTSETTINGS)); + String use = ((IResource) getElement()) + .getPersistentProperty(new QualifiedName(pageId, + USEPROJECTSETTINGS)); if (TRUE.equals(use)) { useProjectSettingsButton.setSelection(true); configureButton.setEnabled(false); @@ -165,8 +181,11 @@ public abstract class OverlayPage extends PropertyPage { /** * Convenience method creating a radio button - * @param parent - the parent composite - * @param label - the button label + * + * @param parent - + * the parent composite + * @param label - + * the button label * @return - the new button */ private Button createRadioButton(Composite parent, String label) { @@ -174,8 +193,8 @@ public abstract class OverlayPage extends PropertyPage { button.setText(label); button.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { - configureButton.setEnabled( - button == useWorkspaceSettingsButton); + configureButton + .setEnabled(button == useWorkspaceSettingsButton); setControlsEnabled(); } }); @@ -183,8 +202,9 @@ public abstract class OverlayPage extends PropertyPage { } /** - * In case of property pages we create a new PropertyStore as local overlay store. - * After all controls have been create, we enable/disable these controls + * In case of property pages we create a new PropertyStore as local overlay + * store. After all controls have been create, we enable/disable these + * controls * * @see org.eclipse.jface.preference.PreferencePage#createControl() */ @@ -194,11 +214,8 @@ public abstract class OverlayPage extends PropertyPage { // Cache the page id pageId = getPageId(); // Create an overlay preference store and fill it with properties - overlayStore = - new PropertyStore( - (IResource) getElement(), - super.getPreferenceStore(), - pageId); + overlayStore = new PropertyStore((IResource) getElement(), super + .getPreferenceStore(), pageId); // Set overlay store as current preference store } super.createControl(parent); @@ -207,8 +224,10 @@ public abstract class OverlayPage extends PropertyPage { setControlsEnabled(); } - /* - * Returns in case of property pages the overlay store - otherwise the standard preference store + /* + * Returns in case of property pages the overlay store - otherwise the + * standard preference store + * * @see org.eclipse.jface.preference.PreferencePage#getPreferenceStore() */ public IPreferenceStore getPreferenceStore() { @@ -226,36 +245,39 @@ public abstract class OverlayPage extends PropertyPage { } /** - * Enables or disables the controls of this page - * Subclasses may override. + * Enables or disables the controls of this page Subclasses may override. * - * @param enabled - true if controls shall be enabled + * @param enabled - + * true if controls shall be enabled */ protected void setControlsEnabled(boolean enabled) { setControlsEnabled(contents, enabled); } /** - * Enables or disables a tree of controls starting at the specified root. - * We spare tabbed notebooks and pagebooks to allow for user navigation. + * Enables or disables a tree of controls starting at the specified root. We + * spare tabbed notebooks and pagebooks to allow for user navigation. * - * @param root - the root composite - * @param enabled - true if controls shall be enabled + * @param root - + * the root composite + * @param enabled - + * true if controls shall be enabled */ private void setControlsEnabled(Composite root, boolean enabled) { Control[] children = root.getChildren(); for (int i = 0; i < children.length; i++) { Control child = children[i]; - if (!(child instanceof CTabFolder) && !(child instanceof TabFolder) && !(child instanceof PageBook)) + if (!(child instanceof CTabFolder) && !(child instanceof TabFolder) + && !(child instanceof PageBook)) child.setEnabled(enabled); if (child instanceof Composite) setControlsEnabled((Composite) child, enabled); } } - /** - * We override the performOk method. In case of property pages - * we save the state of the radio buttons. + /** + * We override the performOk method. In case of property pages we save the + * state of the radio buttons. * * @see org.eclipse.jface.preference.IPreferencePage#performOk() */ @@ -265,11 +287,10 @@ public abstract class OverlayPage extends PropertyPage { // Save state of radiobuttons in project properties IResource resource = (IResource) getElement(); try { - String value = - (useProjectSettingsButton.getSelection()) ? TRUE : FALSE; - resource.setPersistentProperty( - new QualifiedName(pageId, USEPROJECTSETTINGS), - value); + String value = (useProjectSettingsButton.getSelection()) ? TRUE + : FALSE; + resource.setPersistentProperty(new QualifiedName(pageId, + USEPROJECTSETTINGS), value); } catch (CoreException e) { } } @@ -294,13 +315,14 @@ public abstract class OverlayPage extends PropertyPage { /** * Creates a new preferences page and opens it + * * @see com.bdaum.SpellChecker.preferences.SpellCheckerPreferencePage#configureWorkspaceSettings() */ protected void configureWorkspaceSettings() { try { // create a new instance of the current class - IPreferencePage page = - (IPreferencePage) this.getClass().newInstance(); + IPreferencePage page = (IPreferencePage) this.getClass() + .newInstance(); page.setTitle(getTitle()); page.setImageDescriptor(image); // and show it @@ -314,15 +336,18 @@ public abstract class OverlayPage extends PropertyPage { /** * Show a single preference pages - * @param id - the preference page identification - * @param page - the preference page + * + * @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); + final PreferenceDialog dialog = new PreferenceDialog(getControl() + .getShell(), manager); BusyIndicator.showWhile(getControl().getDisplay(), new Runnable() { public void run() { dialog.create();