private FeatureTreeEditorComposite composite;
@Inject
- public FeatureTreeEditor(@Named(IServiceConstants.ACTIVE_SHELL)Shell shell) {
- this.shell = shell;
- if(conversation==null){
- conversation = CdmStore.createConversation();
- }
- if (CdmStore.isActive()) {
- cdmEntitySession = CdmStore.getCurrentSessionManager().newSession(this, true);
- }
+ public FeatureTreeEditor() {
}
/** {@inheritDoc} */
@PostConstruct
- public void createControl(Composite parent, @Named(IServiceConstants.ACTIVE_SHELL) Shell shell) {
+ public void createControl(Composite parent) {
+ if (CdmStore.isActive()){
+ if(conversation == null){
+ conversation = CdmStore.createConversation();
+ }
+ if(cdmEntitySession!=null){
+ cdmEntitySession = CdmStore.getCurrentSessionManager().newSession(this, true);
+ }
+ }
+ else{
+ return;
+ }
composite = new FeatureTreeEditorComposite(parent, SWT.NULL);
composite.init(new FeatureNodeDragListener(composite.getViewer()),
new FeatureNodeDropAdapter(this, composite.getViewer()), this, new SelectionAdapter() {
IStructuredSelection selection = (IStructuredSelection) event
.getSelection();
- composite.getButton_add().setEnabled(selection.size() <= 1);
- composite.getButton_remove().setEnabled(selection.size() > 0);
+ composite.getBtnAdd().setEnabled(selection.size() <= 1);
+ composite.getBtnRemove().setEnabled(selection.size() > 0);
//propagate selection
selService.setSelection(AbstractUtility.getElementsFromSelectionChangedEvent(event));
}
@Focus
- public void focus(){
- composite.getViewer().getControl().setFocus();
+ public void focus(@Named(IServiceConstants.ACTIVE_SHELL) Shell shell){
+ this.shell = shell;
+ if(composite!=null){
+ composite.getViewer().getControl().setFocus();
+ }
if(conversation!=null && !conversation.isBound()){
conversation.bind();
}