Author: dgolovin
Date: 2008-08-29 02:41:31 -0400 (Fri, 29 Aug 2008)
New Revision: 9951
Modified:
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/XMLTextViewerConfiguration.java
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/XmlEditorPlugin.java
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/jst/jsp/preferences/xpl/XMLOccurrencesPreferencePage.java
Log:
Fix PMD Violations
Modified:
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/XMLTextViewerConfiguration.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/XMLTextViewerConfiguration.java 2008-08-29
06:36:13 UTC (rev 9950)
+++
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/XMLTextViewerConfiguration.java 2008-08-29
06:41:31 UTC (rev 9951)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.common.text.xml;
+import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
@@ -126,8 +127,14 @@
Method m =
initial.getClass().getDeclaredMethod("getContentAssistProcessors", new
Class[]{ISourceViewer.class, String.class});
m.setAccessible(true);
return (IContentAssistProcessor[])m.invoke(initial, new Object[]{sourceViewer,
partitionType});
- } catch (Exception e) {
+ } catch (NoSuchMethodException e) {
XmlEditorPlugin.getPluginLog().logError(e);
+ } catch (IllegalArgumentException e) {
+ XmlEditorPlugin.getPluginLog().logError(e);
+ } catch (IllegalAccessException e) {
+ XmlEditorPlugin.getPluginLog().logError(e);
+ } catch (InvocationTargetException e) {
+ XmlEditorPlugin.getPluginLog().logError(e);
}
return null;
Modified:
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/XmlEditorPlugin.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/XmlEditorPlugin.java 2008-08-29
06:36:13 UTC (rev 9950)
+++
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/XmlEditorPlugin.java 2008-08-29
06:41:31 UTC (rev 9951)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.common.text.xml;
+import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
@@ -96,14 +97,18 @@
// XmlPreferenceConstants.initializeDefaultValues(getPreferenceStore());
- try {
- Method m =
AbstractUIPlugin.class.getDeclaredMethod("initializeDefaultPluginPreferences",
new Class[0]);
- m.setAccessible(true);
- m.invoke(JavaPlugin.getDefault(), new Object[0]);
- } catch (Exception e) {
- //ignore
- }
+ Method m;
+ try {
+ m =
AbstractUIPlugin.class.getDeclaredMethod("initializeDefaultPluginPreferences",
new Class[0]);
+ m.setAccessible(true);
+ m.invoke(JavaPlugin.getDefault(), new Object[0]);
+ } catch (NoSuchMethodException e) {
+ } catch (IllegalArgumentException e) {
+ } catch (IllegalAccessException e) {
+ } catch (InvocationTargetException e) {
+ }
+
IPreferenceStore store = getPreferenceStore();
PreferenceConstants.initializeDefaultValues(store);
Modified:
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/jst/jsp/preferences/xpl/XMLOccurrencesPreferencePage.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/jst/jsp/preferences/xpl/XMLOccurrencesPreferencePage.java 2008-08-29
06:36:13 UTC (rev 9950)
+++
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/jst/jsp/preferences/xpl/XMLOccurrencesPreferencePage.java 2008-08-29
06:41:31 UTC (rev 9951)
@@ -79,75 +79,71 @@
*/
protected void createFieldEditors() {
// Initialize all field editors.
- try {
- mark = new BooleanFieldEditor(
- PreferenceKeyGenerator
- .generateKey(
- XMLOccurrencePreferenceConstants.EDITOR_MARK_OCCURRENCES,
- fEditorID),
- Messages
- .getString("OccurrencesPreferencePage.Mark.occurrences.in.file"),
- getFieldEditorParent()); //$NON-NLS-1$
- addField(mark);
+ mark = new BooleanFieldEditor(
+ PreferenceKeyGenerator
+ .generateKey(
+ XMLOccurrencePreferenceConstants.EDITOR_MARK_OCCURRENCES,
+ fEditorID),
+ Messages
+ .getString("OccurrencesPreferencePage.Mark.occurrences.in.file"),
+ getFieldEditorParent()); //$NON-NLS-1$
+ addField(mark);
- markNode = new VarBooleanFieldEditor(
- PreferenceKeyGenerator
- .generateKey(
- XMLOccurrencePreferenceConstants.EDITOR_MARK_NODE_OCCURRENCES,
- fEditorID), Messages
- .getString("OccurrencesPreferencePage.Mark.Tags"),
- getFieldEditorParent()); //$NON-NLS-1$
- markNode.offset(getFieldEditorParent(), 10); // offset 10
- addField(markNode);
+ markNode = new VarBooleanFieldEditor(
+ PreferenceKeyGenerator
+ .generateKey(
+ XMLOccurrencePreferenceConstants.EDITOR_MARK_NODE_OCCURRENCES,
+ fEditorID), Messages
+ .getString("OccurrencesPreferencePage.Mark.Tags"),
+ getFieldEditorParent()); //$NON-NLS-1$
+ markNode.offset(getFieldEditorParent(), 10); // offset 10
+ addField(markNode);
- markAttribute = new VarBooleanFieldEditor(
- PreferenceKeyGenerator
- .generateKey(
- XMLOccurrencePreferenceConstants.EDITOR_MARK_ATTRIBUTE_OCCURRENCES,
- fEditorID),
- Messages
- .getString("OccurrencesPreferencePage.Mark.Attribute.Names"),
- getFieldEditorParent()); //$NON-NLS-1$
- markAttribute.offset(getFieldEditorParent(), 10); // offset 10
- addField(markAttribute);
+ markAttribute = new VarBooleanFieldEditor(
+ PreferenceKeyGenerator
+ .generateKey(
+ XMLOccurrencePreferenceConstants.EDITOR_MARK_ATTRIBUTE_OCCURRENCES,
+ fEditorID),
+ Messages
+ .getString("OccurrencesPreferencePage.Mark.Attribute.Names"),
+ getFieldEditorParent()); //$NON-NLS-1$
+ markAttribute.offset(getFieldEditorParent(), 10); // offset 10
+ addField(markAttribute);
- markAttributeValue = new VarBooleanFieldEditor(
- PreferenceKeyGenerator
- .generateKey(
- XMLOccurrencePreferenceConstants.EDITOR_MARK_ATTRIBUTE_VALUE_OCCURRENCES,
- fEditorID),
- Messages
- .getString("OccurrencesPreferencePage.Mark.Attribute.Values"),
- getFieldEditorParent()); //$NON-NLS-1$
- markAttributeValue.offset(getFieldEditorParent(), 10); // offset 10
- addField(markAttributeValue);
+ markAttributeValue = new VarBooleanFieldEditor(
+ PreferenceKeyGenerator
+ .generateKey(
+ XMLOccurrencePreferenceConstants.EDITOR_MARK_ATTRIBUTE_VALUE_OCCURRENCES,
+ fEditorID),
+ Messages
+ .getString("OccurrencesPreferencePage.Mark.Attribute.Values"),
+ getFieldEditorParent()); //$NON-NLS-1$
+ markAttributeValue.offset(getFieldEditorParent(), 10); // offset 10
+ addField(markAttributeValue);
- markText = new VarBooleanFieldEditor(
- PreferenceKeyGenerator
- .generateKey(
- XMLOccurrencePreferenceConstants.EDITOR_MARK_TEXT_OCCURRENCES,
- fEditorID), Messages
- .getString("OccurrencesPreferencePage.Mark.Text"),
- getFieldEditorParent());
- markText.offset(getFieldEditorParent(), 10); // offset 10
- addField(markText);
+ markText = new VarBooleanFieldEditor(
+ PreferenceKeyGenerator
+ .generateKey(
+ XMLOccurrencePreferenceConstants.EDITOR_MARK_TEXT_OCCURRENCES,
+ fEditorID), Messages
+ .getString("OccurrencesPreferencePage.Mark.Text"),
+ getFieldEditorParent());
+ markText.offset(getFieldEditorParent(), 10); // offset 10
+ addField(markText);
- FieldEditor spacer1 = new LabelFieldEditor(
- "", getFieldEditorParent()); //$NON-NLS-1$
- addField(spacer1);
+ FieldEditor spacer1 = new LabelFieldEditor(
+ "", getFieldEditorParent()); //$NON-NLS-1$
+ addField(spacer1);
- sticky = new VarBooleanFieldEditor(
- PreferenceKeyGenerator
- .generateKey(
- XMLOccurrencePreferenceConstants.EDITOR_STICKY_OCCURRENCES,
- fEditorID), Messages
- .getString("OccurrencesPreferencePage.Sticky"),
- getFieldEditorParent()); //$NON-NLS-1$
- sticky.offset(getFieldEditorParent(), 10); // offset 10
- addField(sticky);
- } catch (Exception x) {
- XmlEditorPlugin.getPluginLog().logError(x);
- }
+ sticky = new VarBooleanFieldEditor(
+ PreferenceKeyGenerator
+ .generateKey(
+ XMLOccurrencePreferenceConstants.EDITOR_STICKY_OCCURRENCES,
+ fEditorID), Messages
+ .getString("OccurrencesPreferencePage.Sticky"),
+ getFieldEditorParent()); //$NON-NLS-1$
+ sticky.offset(getFieldEditorParent(), 10); // offset 10
+ addField(sticky);
}
/*