}
});*/
}
private void initEvents() {
model = new RankingUIModel();
final ProjectController pc = Lookup.getDefault().lookup(ProjectController.class);
pc.addWorkspaceListener(new WorkspaceListener() {
public void initialize(Workspace workspace) {
workspace.add(new RankingUIModel());
}
public void select(Workspace workspace) {
//Enable
enabled = true;
RankingUIModel newModel = workspace.getLookup().lookup(RankingUIModel.class);
if (newModel != null) {
model.loadModel(newModel);
}
refreshModel();
}
public void unselect(Workspace workspace) {
RankingUIModel oldModel = workspace.getLookup().lookup(RankingUIModel.class);
if (oldModel != null) {
workspace.remove(oldModel);
}
workspace.add(model.saveModel());
}
public void close(Workspace workspace) {
}
public void disable() {
enabled = false;
refreshModel();
}
});
if (pc.getCurrentWorkspace() != null) {
enabled = true;
RankingUIModel newModel = pc.getCurrentWorkspace().getLookup().lookup(RankingUIModel.class);
if (newModel != null) {
model.loadModel(newModel);
}
}
}