|
Lines 12-17
Link Here
|
| 12 |
package org.eclipse.hyades.test.tools.ui.common.internal.report; |
12 |
package org.eclipse.hyades.test.tools.ui.common.internal.report; |
| 13 |
|
13 |
|
| 14 |
import org.eclipse.hyades.test.tools.ui.common.internal.report.jscrib.StylesInitializer; |
14 |
import org.eclipse.hyades.test.tools.ui.common.internal.report.jscrib.StylesInitializer; |
|
|
15 |
import org.eclipse.hyades.ui.internal.util.GridDataUtil; |
| 15 |
import org.eclipse.jface.dialogs.Dialog; |
16 |
import org.eclipse.jface.dialogs.Dialog; |
| 16 |
import org.eclipse.jface.preference.PreferencePage; |
17 |
import org.eclipse.jface.preference.PreferencePage; |
| 17 |
import org.eclipse.swt.SWT; |
18 |
import org.eclipse.swt.SWT; |
|
Lines 19-36
Link Here
|
| 19 |
import org.eclipse.swt.layout.GridLayout; |
20 |
import org.eclipse.swt.layout.GridLayout; |
| 20 |
import org.eclipse.swt.widgets.Composite; |
21 |
import org.eclipse.swt.widgets.Composite; |
| 21 |
import org.eclipse.swt.widgets.Control; |
22 |
import org.eclipse.swt.widgets.Control; |
|
|
23 |
import org.eclipse.swt.widgets.Group; |
| 22 |
import org.eclipse.tptp.platform.report.core.internal.DStyleRegistry; |
24 |
import org.eclipse.tptp.platform.report.core.internal.DStyleRegistry; |
| 23 |
import org.eclipse.tptp.platform.report.signals.internal.Signal; |
25 |
import org.eclipse.tptp.platform.report.signals.internal.Signal; |
| 24 |
import org.eclipse.tptp.platform.report.ui.swt.widgets.internal.StylesFieldEditor; |
26 |
import org.eclipse.tptp.platform.report.ui.swt.widgets.internal.StylesFieldEditor; |
| 25 |
import org.eclipse.tptp.test.samples.SamplesPlugin; |
27 |
import org.eclipse.tptp.test.samples.SamplesPlugin; |
|
|
28 |
import org.eclipse.tptp.test.samples.internal.resources.SamplesPluginResourceBundle; |
| 26 |
import org.eclipse.ui.IWorkbench; |
29 |
import org.eclipse.ui.IWorkbench; |
| 27 |
import org.eclipse.ui.IWorkbenchPreferencePage; |
30 |
import org.eclipse.ui.IWorkbenchPreferencePage; |
| 28 |
import org.eclipse.ui.PlatformUI; |
|
|
| 29 |
|
| 30 |
|
| 31 |
|
31 |
|
| 32 |
/** |
32 |
/** |
| 33 |
* @see PreferencePage |
33 |
* |
|
|
34 |
*/ |
| 35 |
/** |
| 36 |
* ReportStylesPreferencePage.java |
| 37 |
* <p/> |
| 38 |
* |
| 39 |
* |
| 40 |
* @author Paul E. Slauenwhite |
| 41 |
* @version April 11, 2008 |
| 42 |
* @since June 6, 2005 |
| 43 |
* @see PreferencePage |
| 34 |
*/ |
44 |
*/ |
| 35 |
public class ReportStylesPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { |
45 |
public class ReportStylesPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { |
| 36 |
|
46 |
|
|
Lines 38-74
Link Here
|
| 38 |
|
48 |
|
| 39 |
public static final String ID = "ReportView.Preferences"; |
49 |
public static final String ID = "ReportView.Preferences"; |
| 40 |
|
50 |
|
| 41 |
private class LocalStylesFieldEditor extends StylesFieldEditor |
51 |
public static Signal sig_asv_graphic_style_chgd = new Signal("valueChanged()"); //$NON-NLS-1$ |
| 42 |
{ |
52 |
|
| 43 |
public LocalStylesFieldEditor(String name, String labelText, |
53 |
private DStyleRegistry registry = null; |
| 44 |
Composite parent) { |
54 |
|
| 45 |
super(name, labelText, parent); |
|
|
| 46 |
} |
| 47 |
public void loadDefault() { |
| 48 |
super.loadDefault(); |
| 49 |
this.setPresentsDefaultValue(false); |
| 50 |
} |
| 51 |
} |
| 52 |
/** |
| 53 |
* |
| 54 |
*/ |
| 55 |
public ReportStylesPreferencePage() { |
55 |
public ReportStylesPreferencePage() { |
| 56 |
} |
56 |
} |
| 57 |
|
57 |
|
| 58 |
/** |
|
|
| 59 |
* @see PreferencePage#init |
| 60 |
*/ |
| 61 |
DStyleRegistry registry = null; |
| 62 |
public void init(IWorkbench workbench) { |
58 |
public void init(IWorkbench workbench) { |
| 63 |
this.registry = StylesInitializer.getCurrentReportStyles(); |
59 |
this.registry = StylesInitializer.getCurrentReportStyles(); |
| 64 |
} |
60 |
} |
| 65 |
|
61 |
|
| 66 |
protected void performDefaults() { |
|
|
| 67 |
this.recentStylesEditor.loadDefault(); |
| 68 |
} |
| 69 |
|
| 70 |
public static Signal sig_asv_graphic_style_chgd = new Signal("valueChanged()"); //$NON-NLS-1$ |
| 71 |
|
| 72 |
public boolean performOk() { |
62 |
public boolean performOk() { |
| 73 |
|
63 |
|
| 74 |
sig_asv_graphic_style_chgd.setBlocked(true); |
64 |
sig_asv_graphic_style_chgd.setBlocked(true); |
|
Lines 77-119
Link Here
|
| 77 |
sig_asv_graphic_style_chgd.emit(); |
67 |
sig_asv_graphic_style_chgd.emit(); |
| 78 |
return true; |
68 |
return true; |
| 79 |
} |
69 |
} |
|
|
70 |
|
| 80 |
public void createControl(Composite parent) { |
71 |
public void createControl(Composite parent) { |
| 81 |
super.createControl(parent); |
72 |
super.createControl(parent); |
| 82 |
//TODO: add call help online |
|
|
| 83 |
// SamplesPlugin.getDefault().getWorkbench().getHelpSystem().setHelp(parent, LLCContextIds.PREF_GRP_STYLE_PAGE); |
| 84 |
|
| 85 |
} |
73 |
} |
|
|
74 |
|
| 75 |
protected void performDefaults() { |
| 76 |
this.recentStylesEditor.loadDefault(); |
| 77 |
} |
| 78 |
|
| 86 |
/** |
79 |
/** |
| 87 |
* @see PreferencePage#createContents |
80 |
* @see PreferencePage#createContents |
| 88 |
*/ |
81 |
*/ |
| 89 |
protected Control createContents(Composite parent) { |
82 |
protected Control createContents(Composite parent) { |
| 90 |
Composite composite = new Composite(parent, SWT.NULL); |
83 |
|
| 91 |
GridLayout layout = new GridLayout(); |
84 |
SamplesPlugin.getDefault().getWorkbench().getHelpSystem().setHelp(parent, SamplesPlugin.getID() + ".ptrf001"); |
| 92 |
layout.marginWidth = 0; |
85 |
|
| 93 |
layout.marginHeight = 0; |
86 |
Composite composite = new Composite(parent, SWT.NONE); |
| 94 |
composite.setLayout(layout); |
87 |
composite.setLayoutData(GridDataUtil.createFill()); |
| 95 |
composite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL)); |
88 |
composite.setLayout(new GridLayout()); |
| 96 |
composite.setFont(parent.getFont()); |
89 |
|
|
|
90 |
final Group sampleReportFontGroup = new Group(composite, SWT.SHADOW_ETCHED_IN); |
| 91 |
sampleReportFontGroup.setLayout(new GridLayout()); |
| 92 |
sampleReportFontGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); |
| 93 |
sampleReportFontGroup.setText(SamplesPluginResourceBundle.TEST_REPORT_FONT_PREFERENCES_GROUP_NAME); |
| 97 |
|
94 |
|
| 98 |
this.recentStylesEditor = new LocalStylesFieldEditor(ReportStylesPreferencePage.ID, "message", composite); //$NON-NLS-1$ |
95 |
this.recentStylesEditor = new LocalStylesFieldEditor(ReportStylesPreferencePage.ID, "message", sampleReportFontGroup); //$NON-NLS-1$ |
| 99 |
this.recentStylesEditor.setStylesRegistry(this.registry); |
96 |
this.recentStylesEditor.setStylesRegistry(this.registry); |
| 100 |
this.recentStylesEditor.setPreferenceStore(SamplesPlugin.getDefault().getPreferenceStore()); |
97 |
this.recentStylesEditor.setPreferenceStore(SamplesPlugin.getDefault().getPreferenceStore()); |
| 101 |
this.recentStylesEditor.setPage(this); |
98 |
this.recentStylesEditor.setPage(this); |
| 102 |
|
99 |
|
| 103 |
sig_asv_graphic_style_chgd.connect(this,"refreshView()"); //$NON-NLS-1$ |
|
|
| 104 |
Dialog.applyDialogFont( composite ); |
100 |
Dialog.applyDialogFont( composite ); |
| 105 |
return composite; |
101 |
return composite; |
| 106 |
} |
102 |
} |
| 107 |
|
103 |
|
| 108 |
/** |
104 |
private class LocalStylesFieldEditor extends StylesFieldEditor |
| 109 |
* this method is connected to the signal sig_asv_graphic_style_chgd and |
105 |
{ |
| 110 |
* it is called when the colors are modified in the preferences and |
106 |
public LocalStylesFieldEditor(String name, String labelText, |
| 111 |
* refreshes the view if it is visible |
107 |
Composite parent) { |
| 112 |
*/ |
108 |
super(name, labelText, parent); |
| 113 |
public void refreshView() |
109 |
} |
| 114 |
{ |
110 |
public void loadDefault() { |
| 115 |
ReportView view = (ReportView)PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(ReportView.ID); //$NON-NLS-1$ |
111 |
super.loadDefault(); |
| 116 |
if(view!=null) |
112 |
this.setPresentsDefaultValue(false); |
| 117 |
view.redrawContent(); |
113 |
} |
| 118 |
} |
114 |
} |
| 119 |
} |
115 |
} |