Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergey Prigogin2010-12-08 21:51:22 -0500
committerSergey Prigogin2010-12-08 21:51:22 -0500
commit0c653690791288764c0f3c0476897cbec3666879 (patch)
tree995365a86bf512a17eb8a277d969c01d445c9895 /debug/org.eclipse.cdt.debug.ui
parent82e06db2d932abb7f87250eb91f9d68402057493 (diff)
downloadorg.eclipse.cdt-0c653690791288764c0f3c0476897cbec3666879.tar.gz
org.eclipse.cdt-0c653690791288764c0f3c0476897cbec3666879.tar.xz
org.eclipse.cdt-0c653690791288764c0f3c0476897cbec3666879.zip
Cosmetics.
Diffstat (limited to 'debug/org.eclipse.cdt.debug.ui')
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/SourcePreferencePage.java131
1 files changed, 65 insertions, 66 deletions
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/SourcePreferencePage.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/SourcePreferencePage.java
index c994c3a643..529f155fe1 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/SourcePreferencePage.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/SourcePreferencePage.java
@@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * QNX Software Systems - Initial API and implementation
+ * QNX Software Systems - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.debug.internal.ui.preferences;
@@ -44,7 +44,6 @@ import org.eclipse.ui.IWorkbenchPreferencePage;
* The "Common Source Lookup Path" preference page.
*/
public class SourcePreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
-
private SourceContainerViewer fPathViewer;
private List<SourceContainerAction> fActions = new ArrayList<SourceContainerAction>(6);
private IWorkbench fWorkbench;
@@ -54,60 +53,60 @@ public class SourcePreferencePage extends PreferencePage implements IWorkbenchPr
/* (non-Javadoc)
* @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
*/
- protected Control createContents( Composite parent ) {
+ protected Control createContents(Composite parent) {
Font font = parent.getFont();
- Composite comp = new Composite( parent, SWT.NONE );
+ Composite comp = new Composite(parent, SWT.NONE);
GridLayout topLayout = new GridLayout();
topLayout.numColumns = 2;
- comp.setLayout( topLayout );
- GridData gd = new GridData( GridData.FILL_BOTH );
- comp.setLayoutData( gd );
- Label viewerLabel = new Label( comp, SWT.LEFT );
- viewerLabel.setText( PreferenceMessages.getString( "SourcePreferencePage.0" ) ); //$NON-NLS-1$
- gd = new GridData( GridData.HORIZONTAL_ALIGN_FILL );
+ comp.setLayout(topLayout);
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ comp.setLayoutData(gd);
+ Label viewerLabel = new Label(comp, SWT.LEFT);
+ viewerLabel.setText(PreferenceMessages.getString("SourcePreferencePage.0")); //$NON-NLS-1$
+ gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gd.horizontalSpan = 2;
- viewerLabel.setLayoutData( gd );
- viewerLabel.setFont( font );
- fPathViewer = new SourceContainerViewer( comp );
- gd = new GridData( GridData.FILL_BOTH );
- fPathViewer.getControl().setLayoutData( gd );
- fPathViewer.getControl().setFont( font );
- Composite pathButtonComp = new Composite( comp, SWT.NONE );
+ viewerLabel.setLayoutData(gd);
+ viewerLabel.setFont(font);
+ fPathViewer = new SourceContainerViewer(comp);
+ gd = new GridData(GridData.FILL_BOTH);
+ fPathViewer.getControl().setLayoutData(gd);
+ fPathViewer.getControl().setFont(font);
+ Composite pathButtonComp = new Composite(comp, SWT.NONE);
GridLayout pathButtonLayout = new GridLayout();
pathButtonLayout.marginHeight = 0;
pathButtonLayout.marginWidth = 0;
- pathButtonComp.setLayout( pathButtonLayout );
- gd = new GridData( GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_FILL );
- pathButtonComp.setLayoutData( gd );
- pathButtonComp.setFont( font );
- createVerticalSpacer( comp, 2 );
- GC gc = new GC( parent );
- gc.setFont( parent.getFont() );
+ pathButtonComp.setLayout(pathButtonLayout);
+ gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_FILL);
+ pathButtonComp.setLayoutData(gd);
+ pathButtonComp.setFont(font);
+ createVerticalSpacer(comp, 2);
+ GC gc = new GC(parent);
+ gc.setFont(parent.getFont());
FontMetrics fontMetrics = gc.getFontMetrics();
gc.dispose();
fAddAction = new AddContainerAction();
- Button button = createPushButton( pathButtonComp, fAddAction.getText(), fontMetrics );
- fAddAction.setButton( button );
- addAction( fAddAction );
+ Button button = createPushButton(pathButtonComp, fAddAction.getText(), fontMetrics);
+ fAddAction.setButton(button);
+ addAction(fAddAction);
fEditAction = new EditContainerAction();
- button = createPushButton( pathButtonComp, fEditAction.getText(), fontMetrics );
- fEditAction.setButton( button );
- addAction( fEditAction );
+ button = createPushButton(pathButtonComp, fEditAction.getText(), fontMetrics);
+ fEditAction.setButton(button);
+ addAction(fEditAction);
SourceContainerAction action = new RemoveAction();
- button = createPushButton( pathButtonComp, action.getText(), fontMetrics );
- action.setButton( button );
- addAction( action );
+ button = createPushButton(pathButtonComp, action.getText(), fontMetrics);
+ action.setButton(button);
+ addAction(action);
action = new UpAction();
- button = createPushButton( pathButtonComp, action.getText(), fontMetrics );
- action.setButton( button );
- addAction( action );
+ button = createPushButton(pathButtonComp, action.getText(), fontMetrics);
+ action.setButton(button);
+ addAction(action);
action = new DownAction();
- button = createPushButton( pathButtonComp, action.getText(), fontMetrics );
- action.setButton( button );
- addAction( action );
- retargetActions( fPathViewer );
- Dialog.applyDialogFont( comp );
- getWorkbench().getHelpSystem().setHelp( comp, ICDebugHelpContextIds.SOURCE_PREFERENCE_PAGE );
+ button = createPushButton(pathButtonComp, action.getText(), fontMetrics);
+ action.setButton(button);
+ addAction(action);
+ retargetActions(fPathViewer);
+ Dialog.applyDialogFont(comp);
+ getWorkbench().getHelpSystem().setHelp(comp, ICDebugHelpContextIds.SOURCE_PREFERENCE_PAGE);
initialize();
return comp;
}
@@ -117,23 +116,23 @@ public class SourcePreferencePage extends PreferencePage implements IWorkbenchPr
*
* @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
*/
- public void init( IWorkbench workbench ) {
+ public void init(IWorkbench workbench) {
fWorkbench = workbench;
}
- private Button createPushButton( Composite parent, String label, FontMetrics fontMetrics ) {
- Button button = new Button( parent, SWT.PUSH );
- button.setFont( parent.getFont() );
- button.setText( label );
- GridData gd = getButtonGridData( button, fontMetrics );
- button.setLayoutData( gd );
+ private Button createPushButton(Composite parent, String label, FontMetrics fontMetrics) {
+ Button button = new Button(parent, SWT.PUSH);
+ button.setFont(parent.getFont());
+ button.setText(label);
+ GridData gd = getButtonGridData(button, fontMetrics);
+ button.setLayoutData(gd);
return button;
}
- private GridData getButtonGridData( Button button, FontMetrics fontMetrics ) {
- GridData gd = new GridData( GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING );
- int widthHint = Dialog.convertHorizontalDLUsToPixels( fontMetrics, IDialogConstants.BUTTON_WIDTH );
- gd.widthHint = Math.max( widthHint, button.computeSize( SWT.DEFAULT, SWT.DEFAULT, true ).x );
+ private GridData getButtonGridData(Button button, FontMetrics fontMetrics) {
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING);
+ int widthHint = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.BUTTON_WIDTH);
+ gd.widthHint = Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
return gd;
}
@@ -141,35 +140,35 @@ public class SourcePreferencePage extends PreferencePage implements IWorkbenchPr
return fWorkbench;
}
- private void addAction( SourceContainerAction action ) {
- fActions.add( action );
+ private void addAction(SourceContainerAction action) {
+ fActions.add(action);
}
- private void retargetActions( SourceContainerViewer viewer ) {
- for ( SourceContainerAction action : fActions ) {
- action.setViewer( viewer );
+ private void retargetActions(SourceContainerViewer viewer) {
+ for (SourceContainerAction action : fActions) {
+ action.setViewer(viewer);
}
}
- private void createVerticalSpacer( Composite comp, int colSpan ) {
- Label label = new Label( comp, SWT.NONE );
+ private void createVerticalSpacer(Composite comp, int colSpan) {
+ Label label = new Label(comp, SWT.NONE);
GridData gd = new GridData();
gd.horizontalSpan = colSpan;
- label.setLayoutData( gd );
+ label.setLayoutData(gd);
}
private void initialize() {
ISourceLookupDirector director = CDebugCorePlugin.getDefault().getCommonSourceLookupDirector();
- fPathViewer.setEntries( director.getSourceContainers() );
- fAddAction.setSourceLookupDirector( director );
- fEditAction.setSourceLookupDirector( director );
+ fPathViewer.setEntries(director.getSourceContainers());
+ fAddAction.setSourceLookupDirector(director);
+ fEditAction.setSourceLookupDirector(director);
}
/* (non-Javadoc)
* @see org.eclipse.jface.preference.PreferencePage#performDefaults()
*/
protected void performDefaults() {
- fPathViewer.setEntries( new ISourceContainer[0] );
+ fPathViewer.setEntries(new ISourceContainer[0]);
super.performDefaults();
}
@@ -177,7 +176,7 @@ public class SourcePreferencePage extends PreferencePage implements IWorkbenchPr
* @see org.eclipse.jface.preference.PreferencePage#performOk()
*/
public boolean performOk() {
- CDebugCorePlugin.getDefault().getCommonSourceLookupDirector().setSourceContainers( fPathViewer.getEntries() );
+ CDebugCorePlugin.getDefault().getCommonSourceLookupDirector().setSourceContainers(fPathViewer.getEntries());
CDebugCorePlugin.getDefault().savePluginPreferences();
return true;
}

Back to the top