Author: scabanovich
Date: 2011-06-20 12:07:10 -0400 (Mon, 20 Jun 2011)
New Revision: 32219
Modified:
trunk/common/plugins/org.jboss.tools.common.ui/META-INF/MANIFEST.MF
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/preferences/SeverityConfigurationBlock.java
Log:
JBIDE-9185
https://issues.jboss.org/browse/JBIDE-9185
JBIDE-9195
https://issues.jboss.org/browse/JBIDE-9195
Modified: trunk/common/plugins/org.jboss.tools.common.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.ui/META-INF/MANIFEST.MF 2011-06-20
16:00:55 UTC (rev 32218)
+++ trunk/common/plugins/org.jboss.tools.common.ui/META-INF/MANIFEST.MF 2011-06-20
16:07:10 UTC (rev 32219)
@@ -12,7 +12,7 @@
org.eclipse.core.resources;bundle-version="3.7.100",
org.eclipse.ui.ide;bundle-version="3.7.0",
org.eclipse.jst.j2ee.ui;bundle-version="1.1.500",
- org.eclipse.ui.forms;bundle-version="3.5.100",
+ org.eclipse.ui.forms;bundle-version="3.5.100";visibility:=reexport,
org.eclipse.ui.workbench.texteditor;bundle-version="3.7.0",
org.eclipse.jface.text;bundle-version="3.7.0"
Export-Package: org.jboss.tools.common.ui,
Modified:
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/preferences/SeverityConfigurationBlock.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/preferences/SeverityConfigurationBlock.java 2011-06-20
16:00:55 UTC (rev 32218)
+++
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/preferences/SeverityConfigurationBlock.java 2011-06-20
16:07:10 UTC (rev 32219)
@@ -11,6 +11,8 @@
package org.jboss.tools.common.ui.preferences;
+import java.util.ArrayList;
+
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jdt.core.JavaCore;
@@ -19,6 +21,7 @@
import org.eclipse.jdt.internal.ui.preferences.OptionsConfigurationBlock;
import org.eclipse.jdt.internal.ui.preferences.PreferencesMessages;
import org.eclipse.jdt.internal.ui.preferences.ScrolledPageContent;
+import org.eclipse.jdt.internal.ui.preferences.OptionsConfigurationBlock.Key;
import org.eclipse.jdt.internal.ui.wizards.IStatusChangeListener;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogSettings;
@@ -54,6 +57,8 @@
* );
* create required constant and property in SeverityPreferencesMessages,
* and add SECTION_A to array ALL_SECTIONS.
+ *
+ * Also, see ProblemSeveritiesConfigurationBlock
*
* @author Viacheslav Kabanovich
*/
@@ -77,6 +82,8 @@
protected PixelConverter fPixelConverter;
+ protected FilteredPreferenceTree fFilteredPrefTree;
+
public SeverityConfigurationBlock(IStatusChangeListener context,
IProject project, Key[] allKeys,
IWorkbenchPreferenceContainer container) {
@@ -91,56 +98,65 @@
protected Composite createStyleTabContent(Composite folder) {
int nColumns = 3;
+ GridLayout layout= new GridLayout(nColumns, false);
+ layout.marginHeight= 0;
+ layout.marginWidth= 0;
+ Composite c = new Composite(folder, 0);
+ c.setLayout(layout);
+ c.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- final ScrolledPageContent sc1 = new ScrolledPageContent(folder);
+ addMaxNumberOfMarkersField(c);
+ addWrongBuilderOrderField(c);
+ fFilteredPrefTree = new FilteredPreferenceTree(this, folder, getCommonDescription());
+ final ScrolledPageContent sc1 = fFilteredPrefTree.getScrolledPageContent();
+
Composite composite = sc1.getBody();
- addMaxNumberOfMarkersField(composite);
-
- addWrongBuilderOrderField(composite);
-
- GridLayout layout= new GridLayout(nColumns, false);
- layout.marginHeight= 0;
- layout.marginWidth= 0;
composite.setLayout(layout);
- Label description= new Label(composite, SWT.LEFT | SWT.WRAP);
- description.setFont(description.getFont());
- description.setText(getCommonDescription());
- description.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, true,
false, nColumns - 1, 1));
-
int defaultIndent = 0;
- SectionDescription[] sections = getAllSections();
- for (int i = 0; i < sections.length; i++) {
- SectionDescription section = sections[i];
- String label = section.label;
- ExpandableComposite excomposite = createStyleSection(composite, label, nColumns);
-
- Composite inner = new Composite(excomposite, SWT.NONE);
- inner.setFont(composite.getFont());
- inner.setLayout(new GridLayout(nColumns, false));
- excomposite.setClient(inner);
-
- for (int j = 0; j < section.options.length; j++) {
- OptionDescription option = section.options[j];
- label = option.label;
- addComboBox(inner, label, option.key, errorWarningIgnore, errorWarningIgnoreLabels,
defaultIndent);
- }
+ for (SectionDescription section: getAllSections()) {
+ createSection(null, section, composite, nColumns, defaultIndent);
}
- IDialogSettings section = getDialogSettings();
- restoreSectionExpansionStates(section);
+ restoreSectionExpansionStates(getDialogSettings());
return sc1;
}
+ protected Composite createInnerComposite(ExpandableComposite excomposite, int nColumns,
Font font) {
+ Composite inner= new Composite(excomposite, SWT.NONE);
+ inner.setFont(font);
+ inner.setLayout(new GridLayout(nColumns, false));
+ excomposite.setClient(inner);
+ return inner;
+ }
+ protected void createSection(PreferenceTreeNode parent, SectionDescription section,
Composite composite, int nColumns, int defaultIndent) {
+ String label = section.getLabel();
+
+ Key twistieKey = OptionsConfigurationBlock.getLocalKey(label.replace(' ',
'_'));
+ PreferenceTreeNode treeSection = fFilteredPrefTree.addExpandableComposite(composite,
label, nColumns, twistieKey, parent, false);
+ ExpandableComposite excomposite = getExpandableComposite(twistieKey);
+ Composite inner = createInnerComposite(excomposite, nColumns, composite.getFont());
+
+ for (SectionDescription s: section.getSections()) {
+ createSection(treeSection, s, inner, nColumns, defaultIndent);
+ }
+
+ for (OptionDescription option: section.getOptions()) {
+ label = option.label;
+ fFilteredPrefTree.addComboBox(inner, label, option.key, errorWarningIgnore,
errorWarningIgnoreLabels, defaultIndent, treeSection);
+ }
+ }
+
protected void addMaxNumberOfMarkersField(Composite composite) {
Text text = addTextField(composite, SeverityPreferencesMessages.MAX_NUMBER_OF_MARKERS,
getMaxNumberOfProblemsKey(), 0, 0);
GridData gd = (GridData) text.getLayoutData();
gd.widthHint = fPixelConverter.convertWidthInCharsToPixels(8);
gd.horizontalAlignment = GridData.BEGINNING;
+ text.setLayoutData(gd);
text.setTextLimit(6);
}
@@ -229,28 +245,44 @@
return;
}
- if (changedKey != null) {
- if (getMaxNumberOfProblemsKey().equals(changedKey)) {
- fContext.statusChanged(validateMaxNumberProblems());
- return;
- } else {
- return;
- }
+ if (changedKey == null || getMaxNumberOfProblemsKey().equals(changedKey)) {
+ fContext.statusChanged(validateMaxNumberProblems());
}
- fContext.statusChanged(validateMaxNumberProblems());
}
public static class SectionDescription {
- public String label;
- public OptionDescription[] options;
+ private String label;
+ private SectionDescription[] sections;
+ private OptionDescription[] options;
public SectionDescription(String label, String[][] optionLabelsAndKeys, String
pluginId) {
+ this(label, new SectionDescription[0], optionLabelsAndKeys, pluginId);
+ }
+ public SectionDescription(String label, SectionDescription[] sections, String[][]
optionLabelsAndKeys, String pluginId) {
this.label = label;
+ this.sections = sections;
options = new OptionDescription[optionLabelsAndKeys.length];
for (int i = 0; i < options.length; i++) {
options[i] = new OptionDescription(optionLabelsAndKeys[i][0],
optionLabelsAndKeys[i][1], pluginId);
}
}
+ public String getLabel() {
+ return label;
+ }
+ public SectionDescription[] getSections() {
+ return sections;
+ }
+ public OptionDescription[] getOptions() {
+ return options;
+ }
+ public void collectKeys(ArrayList<Key> keys) {
+ for (SectionDescription s: sections) {
+ s.collectKeys(keys);
+ }
+ for (OptionDescription o: options) {
+ keys.add(o.key);
+ }
+ }
}
public static class OptionDescription {