Skip to content

Commit bbd6518

Browse files
committed
Deprecate editor factories
1 parent b1a0f4a commit bbd6518

19 files changed

+184
-124
lines changed

net.sourceforge.pmd.eclipse.plugin/src/main/java/net/sourceforge/pmd/eclipse/ui/preferences/editors/AbstractEditorFactory.java

Lines changed: 4 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -4,127 +4,11 @@
44

55
package net.sourceforge.pmd.eclipse.ui.preferences.editors;
66

7-
import org.eclipse.swt.SWT;
8-
import org.eclipse.swt.layout.GridData;
9-
import org.eclipse.swt.widgets.Composite;
10-
import org.eclipse.swt.widgets.Control;
11-
import org.eclipse.swt.widgets.Label;
12-
13-
import net.sourceforge.pmd.eclipse.ui.preferences.br.EditorFactory;
14-
import net.sourceforge.pmd.eclipse.ui.preferences.br.SizeChangeListener;
15-
import net.sourceforge.pmd.eclipse.ui.preferences.br.ValueChangeListener;
16-
import net.sourceforge.pmd.eclipse.util.ColourManager;
17-
import net.sourceforge.pmd.properties.PropertyDescriptor;
18-
import net.sourceforge.pmd.properties.PropertySource;
19-
207
/**
218
* @author Brian Remedios
9+
* @deprecated This editor factory will be removed without replacement. This was only used for supporting the UI
10+
* of the plugin and is considered internal API now.
2211
*/
23-
public abstract class AbstractEditorFactory<T> implements EditorFactory<T> {
24-
25-
protected static ColourManager colourManager;
26-
// protected static Color overriddenColour;
27-
28-
protected AbstractEditorFactory() {
29-
// protected default constructor for subclassing
30-
}
31-
32-
// private static ColourManager colourManager() {
33-
//
34-
// if (colourManager != null) return colourManager;
35-
// colourManager = ColourManager.managerFor(Display.getDefault());
36-
// return colourManager;
37-
// }
38-
39-
// private Color overriddenColour() {
40-
//
41-
// if (overriddenColour != null) return overriddenColour;
42-
//
43-
// overriddenColour =
44-
// colourManager().colourFor(AbstractRulePanelManager.overridenColourValues);
45-
// return overriddenColour;
46-
// }
47-
48-
/**
49-
* Generic control that provides a label/widget pair for the default value.
50-
* Subclasses can override this to provide additional labels & widgets as
51-
* necessary but must be able to extract the values held by them when the
52-
* property is created.
53-
*/
54-
@Override
55-
public Control[] createOtherControlsOn(Composite parent, PropertyDescriptor<T> desc, PropertySource source,
56-
ValueChangeListener listener, SizeChangeListener sizeListener) {
57-
return new Control[] { newLabel(parent, "Default"), newEditorOn(parent, desc, source, listener, sizeListener) };
58-
}
59-
60-
protected Label newLabel(Composite parent, String text) {
61-
Label label = new Label(parent, SWT.None);
62-
label.setText(text);
63-
return label;
64-
}
65-
66-
protected abstract T valueFrom(Control valueControl);
67-
68-
protected T valueFor(PropertySource source, PropertyDescriptor<T> desc) {
69-
70-
return source.hasDescriptor(desc) ? source.getProperty(desc) : desc.defaultValue();
71-
}
72-
73-
@Override
74-
public Label addLabel(Composite parent, PropertyDescriptor<T> desc) {
75-
Label label = new Label(parent, SWT.NONE);
76-
label.setText(desc.name() + " (" + desc.description() + ")");
77-
GridData data = new GridData();
78-
data.horizontalAlignment = SWT.LEFT;
79-
// CENTER is preferred only when showing a single row value widget...hmm
80-
data.verticalAlignment = SWT.CENTER;
81-
label.setLayoutData(data);
82-
return label;
83-
}
84-
85-
/**
86-
* Adjust the display of the control to denote whether it holds onto the
87-
* default value or not.
88-
*
89-
* @param control
90-
* @param hasDefaultValue
91-
*/
92-
// protected void adjustRendering(Control control, boolean hasDefaultValue)
93-
// {
94-
//
95-
// Display display = control.getDisplay();
96-
//
97-
// control.setBackground(
98-
// display.getSystemColor(hasDefaultValue ? SWT.COLOR_WHITE :
99-
// SWT.COLOR_CYAN)
100-
// );
101-
// }
102-
protected void adjustRendering(PropertySource source, PropertyDescriptor<?> desc, Control control) {
103-
104-
// return; // don't do it...kinda irritating
105-
106-
// if (!(rule instanceof RuleReference)) return;
107-
//
108-
// boolean isOverridden =
109-
// ((RuleReference)rule).hasOverriddenProperty(desc);
110-
// Display display = control.getDisplay();
111-
// Color clr = isOverridden ? overriddenColour() :
112-
// display.getSystemColor(SWT.COLOR_WHITE);
113-
//
114-
// control.setBackground(clr);
115-
}
116-
117-
/**
118-
* Return the value as a string that can be easily recognized and parsed
119-
* when we see it again.
120-
*
121-
* @param value
122-
* Object
123-
*
124-
* @return String
125-
*/
126-
protected static String asString(Object value) {
127-
return value == null ? "" : value.toString();
128-
}
129-
12+
@Deprecated // for removal
13+
public abstract class AbstractEditorFactory<T> extends net.sourceforge.pmd.eclipse.ui.preferences.internal.AbstractEditorFactory<T> {
13014
}

net.sourceforge.pmd.eclipse.plugin/src/main/java/net/sourceforge/pmd/eclipse/ui/preferences/editors/AbstractMultiValueEditorFactory.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@
4848
* and update the values in the rule listings respectively.
4949
*
5050
* @author Brian Remedios
51+
* @deprecated This editor factory will be removed without replacement. This was only used for supporting the UI
52+
* of the plugin and is considered internal API now.
5153
*/
54+
@Deprecated // for removal
5255
public abstract class AbstractMultiValueEditorFactory<T> extends AbstractEditorFactory<List<T>> {
5356

5457
protected static final String DELIMITER = ",";

net.sourceforge.pmd.eclipse.plugin/src/main/java/net/sourceforge/pmd/eclipse/ui/preferences/editors/AbstractNumericEditorFactory.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@
2020

2121
/**
2222
* @author Brian Remedios
23+
* @deprecated This editor factory will be removed without replacement. This was only used for supporting the UI
24+
* of the plugin and is considered internal API now.
2325
*/
26+
@Deprecated // for removal
2427
public abstract class AbstractNumericEditorFactory<T> extends AbstractEditorFactory<T> {
2528

2629
public static final int DEFAULT_MINIMUM = 0;

net.sourceforge.pmd.eclipse.plugin/src/main/java/net/sourceforge/pmd/eclipse/ui/preferences/editors/AbstractRealNumberEditor.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@
1212

1313
/**
1414
* @author Brian Remedios
15+
* @deprecated This editor factory will be removed without replacement. This was only used for supporting the UI
16+
* of the plugin and is considered internal API now.
1517
*/
18+
@Deprecated // for removal
1619
public abstract class AbstractRealNumberEditor<T extends Number> extends AbstractNumericEditorFactory<T> {
1720

1821
protected static final int DIGITS = 3;

net.sourceforge.pmd.eclipse.plugin/src/main/java/net/sourceforge/pmd/eclipse/ui/preferences/editors/BooleanEditorFactory.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@
1919

2020
/**
2121
* @author Brian Remedios
22+
* @deprecated This editor factory will be removed without replacement. This was only used for supporting the UI
23+
* of the plugin and is considered internal API now.
2224
*/
25+
@Deprecated // for removal
2326
public final class BooleanEditorFactory extends AbstractEditorFactory<Boolean> {
2427

2528
public static final BooleanEditorFactory INSTANCE = new BooleanEditorFactory();

net.sourceforge.pmd.eclipse.plugin/src/main/java/net/sourceforge/pmd/eclipse/ui/preferences/editors/CharacterEditorFactory.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@
2020

2121
/**
2222
* @author Brian Remedios
23+
* @deprecated This editor factory will be removed without replacement. This was only used for supporting the UI
24+
* of the plugin and is considered internal API now.
2325
*/
26+
@Deprecated // for removal
2427
public final class CharacterEditorFactory extends AbstractEditorFactory<Character> {
2528

2629
public static final CharacterEditorFactory INSTANCE = new CharacterEditorFactory();

net.sourceforge.pmd.eclipse.plugin/src/main/java/net/sourceforge/pmd/eclipse/ui/preferences/editors/DoubleEditorFactory.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@
1919

2020
/**
2121
* @author Brian Remedios
22+
* @deprecated This editor factory will be removed without replacement. This was only used for supporting the UI
23+
* of the plugin and is considered internal API now.
2224
*/
25+
@Deprecated // for removal
2326
public final class DoubleEditorFactory extends AbstractRealNumberEditor<Double> {
2427

2528
public static final DoubleEditorFactory INSTANCE = new DoubleEditorFactory();

net.sourceforge.pmd.eclipse.plugin/src/main/java/net/sourceforge/pmd/eclipse/ui/preferences/editors/EnumerationEditorFactory.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@
2222

2323
/**
2424
* @author Brian Remedios
25+
* @deprecated This editor factory will be removed without replacement. This was only used for supporting the UI
26+
* of the plugin and is considered internal API now.
2527
*/
28+
@Deprecated // for removal
2629
public final class EnumerationEditorFactory extends AbstractEditorFactory<Object> {
2730

2831
public static final EnumerationEditorFactory INSTANCE = new EnumerationEditorFactory();

net.sourceforge.pmd.eclipse.plugin/src/main/java/net/sourceforge/pmd/eclipse/ui/preferences/editors/FilePicker.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@
2525
* A general purpose selection widget that deals with files.
2626
*
2727
* @author Brian Remedios
28+
* @deprecated This class is not used and will be removed.
2829
*/
30+
@Deprecated // for removal
2931
public class FilePicker extends Composite {
3032

3133
private Text fileField;

net.sourceforge.pmd.eclipse.plugin/src/main/java/net/sourceforge/pmd/eclipse/ui/preferences/editors/IntegerEditorFactory.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@
1919

2020
/**
2121
* @author Brian Remedios
22+
* @deprecated This editor factory will be removed without replacement. This was only used for supporting the UI
23+
* of the plugin and is considered internal API now.
2224
*/
25+
@Deprecated // for removal
2326
public final class IntegerEditorFactory extends AbstractNumericEditorFactory<Integer> {
2427

2528
public static final IntegerEditorFactory INSTANCE = new IntegerEditorFactory();

0 commit comments

Comments
 (0)