Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(244)

Unified Diff: editor/tools/plugins/com.xored.glance.ui/src/com/xored/glance/internal/ui/sources/TextSourceMaker.java

Issue 17431004: New UI for Find command: find-as-you-type. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: editor/tools/plugins/com.xored.glance.ui/src/com/xored/glance/internal/ui/sources/TextSourceMaker.java
===================================================================
--- editor/tools/plugins/com.xored.glance.ui/src/com/xored/glance/internal/ui/sources/TextSourceMaker.java (revision 0)
+++ editor/tools/plugins/com.xored.glance.ui/src/com/xored/glance/internal/ui/sources/TextSourceMaker.java (revision 0)
@@ -0,0 +1,70 @@
+/**
+ *
+ */
+package com.xored.glance.internal.ui.sources;
+
+import org.eclipse.swt.widgets.Control;
+
+import com.xored.glance.ui.sources.ITextSource;
+import com.xored.glance.ui.sources.ITextSourceDescriptor;
+
+/**
+ * @author Yuri Strot
+ */
+public class TextSourceMaker {
+
+ public TextSourceMaker(ITextSourceDescriptor description, Control control) {
+ this.description = description;
+ this.control = control;
+ }
+
+ public boolean isValid() {
+ return description == null ? false : description.isValid(control);
+ }
+
+ public ITextSource create() {
+ return description == null ? null : description.createSource(control);
+ }
+
+ /**
+ * @return the control
+ */
+ public Control getControl() {
+ return control;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((control == null) ? 0 : control.hashCode());
+ result = prime * result + ((description == null) ? 0 : description.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ TextSourceMaker other = (TextSourceMaker) obj;
+ if (control == null) {
+ if (other.control != null)
+ return false;
+ } else if (!control.equals(other.control))
+ return false;
+ if (description == null) {
+ if (other.description != null)
+ return false;
+ } else if (!description.equals(other.description))
+ return false;
+ return true;
+ }
+
+ private ITextSourceDescriptor description;
+ private Control control;
+
+}

Powered by Google App Engine
This is Rietveld 408576698