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
diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/editor/WPPropertySource.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/editor/WPPropertySource.java
new file mode 100644 (file)
index 0000000..6d5e14f
--- /dev/null
@@ -0,0 +1,92 @@
+package net.sourceforge.phpeclipse.wiki.editor;
+
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.eclipse.ui.views.properties.IResourcePropertyConstants;
+import org.eclipse.ui.views.properties.PropertyDescriptor;
+
+public class WPPropertySource implements IPropertySource {
+  //  final boolean isWPFile;
+  /**
+   * The <code>IResource</code> property key for Wikipedia timestamp.
+   */
+  public static final String P_TIMESTAMP = "net.sourceforge.phpeclipse.wiki.timestamp"; //$NON-NLS-1$
+
+  private static PropertyDescriptor wpEditorDescriptor;
+  { 
+    wpEditorDescriptor = new PropertyDescriptor(P_TIMESTAMP, "Wikipedia Timestamp");
+    wpEditorDescriptor.setAlwaysIncompatible(true);
+    wpEditorDescriptor.setCategory(IResourcePropertyConstants.P_FILE_SYSTEM_CATEGORY);
+  }
+
+  public WPPropertySource(WikiEditor source) {
+    //    super(source);
+    //    if (file.getFileExtension().equalsIgnoreCase("wp")) {
+    //      isWPFile = true;
+    //      return;
+    //    }
+    //    isWPFile = false;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyDescriptors()
+   */
+  public IPropertyDescriptor[] getPropertyDescriptors() {
+    IPropertyDescriptor[] p = new IPropertyDescriptor[1];
+    p[0] = wpEditorDescriptor;
+    return p;
+    //    if (isWPFile) {
+    //      IPropertyDescriptor[] sp = super.getPropertyDescriptors();
+    //      IPropertyDescriptor[] p = new IPropertyDescriptor[sp.length+1];
+    //      System.arraycopy(sp,0,p,0,sp.length);
+    //      p[sp.length] = wpEditorDescriptor;
+    //      return p;
+    //    }
+    //    return super.getPropertyDescriptors();
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(java.lang.Object)
+   */
+  public Object getPropertyValue(Object key) {
+    //    Object returnValue = super.getPropertyValue(key);
+    //
+    //    if (returnValue != null)
+    //      return returnValue;
+
+    if (key.equals(P_TIMESTAMP))
+      return "4711";
+
+    return null;
+  }
+  /* (non-Javadoc)
+   * @see org.eclipse.ui.views.properties.IPropertySource#getEditableValue()
+   */
+  public Object getEditableValue() {
+    // TODO Auto-generated method stub
+    return null;
+  }
+  /* (non-Javadoc)
+   * @see org.eclipse.ui.views.properties.IPropertySource#isPropertySet(java.lang.Object)
+   */
+  public boolean isPropertySet(Object id) {
+    return id.equals(P_TIMESTAMP);
+  }
+  /* (non-Javadoc)
+   * @see org.eclipse.ui.views.properties.IPropertySource#resetPropertyValue(java.lang.Object)
+   */
+  public void resetPropertyValue(Object id) {
+
+  }
+  /* (non-Javadoc)
+   * @see org.eclipse.ui.views.properties.IPropertySource#setPropertyValue(java.lang.Object, java.lang.Object)
+   */
+  public void setPropertyValue(Object id, Object value) {
+
+  }
+}
\ No newline at end of file