private final List<ChangeListener> listeners = new ArrayList<ChangeListener>();
private DynamicModel dynamicModel;
public RankingModelImpl() {
final ProjectController pc = Lookup.getDefault().lookup(ProjectController.class);
final AttributeController ac = Lookup.getDefault().lookup(AttributeController.class);
pc.addWorkspaceListener(new WorkspaceListener() {
public void initialize(Workspace workspace) {
}
public void select(Workspace workspace) {
AttributeModel attributeModel = workspace.getLookup().lookup(AttributeModel.class);
attributeModel.addAttributeListener(RankingModelImpl.this);
}
public void unselect(Workspace workspace) {
AttributeModel attributeModel = workspace.getLookup().lookup(AttributeModel.class);
attributeModel.removeAttributeListener(RankingModelImpl.this);
dynamicModel = null;
}
public void close(Workspace workspace) {
}
public void disable() {
dynamicModel = null;
}
});
if (pc.getCurrentWorkspace() != null) {
AttributeModel attributeModel = pc.getCurrentWorkspace().getLookup().lookup(AttributeModel.class);
attributeModel.addAttributeListener(RankingModelImpl.this);
}
}