Author: dazarov
Date: 2012-05-14 20:32:15 -0400 (Mon, 14 May 2012)
New Revision: 41012
Modified:
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/marker/ConfigureProblemSeverityMarkerResolution.java
Log:
NPE when press OK on preference page
https://issues.jboss.org/browse/JBIDE-11859
Modified:
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/marker/ConfigureProblemSeverityMarkerResolution.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/marker/ConfigureProblemSeverityMarkerResolution.java 2012-05-14
23:50:54 UTC (rev 41011)
+++
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/marker/ConfigureProblemSeverityMarkerResolution.java 2012-05-15
00:32:15 UTC (rev 41012)
@@ -22,6 +22,7 @@
import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.eclipse.jdt.internal.ui.JavaPluginImages;
import org.eclipse.jface.preference.IPreferenceNode;
+import org.eclipse.jface.preference.IPreferencePage;
import org.eclipse.jface.preference.PreferenceManager;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.graphics.Image;
@@ -93,15 +94,33 @@
}
private String getPreferenceLabel() {
+ String label = "";
WorkbenchPreferenceNode pageNode = findPageNode();
- pageNode.createPage();
- if(pageNode != null && pageNode.getPage() instanceof SeverityPreferencePage){
- SeverityPreferencePage page = (SeverityPreferencePage)pageNode.getPage();
- return cut(page.getLabel(preferenceKey));
+ if(pageNode != null){
+ IPreferencePage page = pageNode.getPage();
+ if(page == null){
+ pageNode.createPage();
+
+ page = pageNode.getPage();
+
+ label = getLabel(page);
+
+ pageNode.setPage(null);
+ page.dispose();
+ }else{
+ label = getLabel(page);
+ }
}
- return null;
+ return label;
}
+ private String getLabel(IPreferencePage page){
+ if(page instanceof SeverityPreferencePage){
+ return cut(((SeverityPreferencePage)page).getLabel(preferenceKey));
+ }
+ return "";
+ }
+
private String cut(String label){
if(label.length() > PREFERENCE_SIZE){
return label.substring(0, PREFERENCE_SIZE-1)+DOTS;