Posts

Showing posts with the label inteface

Eclipse command framework core expression: Property tester

Image
Addition to Eclipse command framework series, this post explains use of property tester to control command’s enable/visible properties. In earlier post we have tried declarative way to achieve same thing but property tester gives us more control. Property tester is associated with, tester class which implements PropertyTester.java, a namespace and set of property which it supports. We can refer this property tester using its namespace + a property name. It gives you call back to test() method with property name as parameter inside property tester class. We can configure property tester for type of input parameter. Here is sample declaration of property tester extension point < extension point ="org.eclipse.core.expressions.propertyTesters" > < propertyTester class ="com.example.advance.cmd.EditorTester" id ="com.example.advance.cmd.propertyTester1" namespace ="com.example.advance.cm...

Understanding Observer Designing Pattern by Example

Image
  “The Observer pattern define a one to many dependency between objects so that when one object changes state, all of its dependents are notified and updated automatically.” With the observer pattern, the source is the object that contain the state and control it. The Observer on the other hand use the state, even if they don’t own it. The observer pattern provides an object design where the subject and observer are loosely coupled. Here is the Class Diagram explaining Benefit of loosely coupling The only thing the subject knows about an Observer is that it implements a certain interface We can add new Observer at any time We never need to modify subject to add more observer. We can use subject or observer independently of each other. Change in either observer or Source will not affect the other. Here is an example : This example explains Observer pattern, here source generates random characters and observer, Java Swing component listen this eve...