Enable word wrapping with preference key editor.wrap.words (false by default)
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.wiki / src / net / sourceforge / phpeclipse / wiki / editor / WPPropertySource.java
1 package net.sourceforge.phpeclipse.wiki.editor;
2
3 import org.eclipse.ui.views.properties.IPropertyDescriptor;
4 import org.eclipse.ui.views.properties.IPropertySource;
5 import org.eclipse.ui.views.properties.IResourcePropertyConstants;
6 import org.eclipse.ui.views.properties.PropertyDescriptor;
7
8 public class WPPropertySource implements IPropertySource {
9   //  final boolean isWPFile;
10  
11   /**
12    * The <code>IResource</code> property key for Wikipedia timestamp.
13    */
14   public static final String P_TIMESTAMP = "net.sourceforge.phpeclipse.wiki.timestamp"; //$NON-NLS-1$
15
16   private static PropertyDescriptor wpEditorDescriptor;
17   { 
18     wpEditorDescriptor = new PropertyDescriptor(P_TIMESTAMP, "Wikipedia Timestamp");
19     wpEditorDescriptor.setAlwaysIncompatible(true);
20     wpEditorDescriptor.setCategory(IResourcePropertyConstants.P_FILE_SYSTEM_CATEGORY);
21   }
22
23   public WPPropertySource(WikiEditor source) {
24     //    super(source);
25     //    if (file.getFileExtension().equalsIgnoreCase("wp")) {
26     //      isWPFile = true;
27     //      return;
28     //    }
29     //    isWPFile = false;
30   }
31
32   /*
33    * (non-Javadoc)
34    * 
35    * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyDescriptors()
36    */
37   public IPropertyDescriptor[] getPropertyDescriptors() {
38     IPropertyDescriptor[] p = new IPropertyDescriptor[1];
39     p[0] = wpEditorDescriptor;
40     return p;
41     //    if (isWPFile) {
42     //      IPropertyDescriptor[] sp = super.getPropertyDescriptors();
43     //      IPropertyDescriptor[] p = new IPropertyDescriptor[sp.length+1];
44     //      System.arraycopy(sp,0,p,0,sp.length);
45     //      p[sp.length] = wpEditorDescriptor;
46     //      return p;
47     //    }
48     //    return super.getPropertyDescriptors();
49   }
50
51   /*
52    * (non-Javadoc)
53    * 
54    * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(java.lang.Object)
55    */
56   public Object getPropertyValue(Object key) {
57     //    Object returnValue = super.getPropertyValue(key);
58     //
59     //    if (returnValue != null)
60     //      return returnValue;
61
62     if (key.equals(P_TIMESTAMP))
63       return "4711";
64
65     return null;
66   }
67   /* (non-Javadoc)
68    * @see org.eclipse.ui.views.properties.IPropertySource#getEditableValue()
69    */
70   public Object getEditableValue() {
71     // TODO Auto-generated method stub
72     return null;
73   }
74   /* (non-Javadoc)
75    * @see org.eclipse.ui.views.properties.IPropertySource#isPropertySet(java.lang.Object)
76    */
77   public boolean isPropertySet(Object id) {
78     return id.equals(P_TIMESTAMP);
79   }
80   /* (non-Javadoc)
81    * @see org.eclipse.ui.views.properties.IPropertySource#resetPropertyValue(java.lang.Object)
82    */
83   public void resetPropertyValue(Object id) {
84
85   }
86   /* (non-Javadoc)
87    * @see org.eclipse.ui.views.properties.IPropertySource#setPropertyValue(java.lang.Object, java.lang.Object)
88    */
89   public void setPropertyValue(Object id, Object value) {
90
91   }
92 }