]> gerrit.simantics Code Review - simantics/platform.git/blob - swt/core/widget/SCLTextEditorSaveHandler.java
Fixed multiple issues causing dangling references to discarded queries
[simantics/platform.git] / swt / core / widget / SCLTextEditorSaveHandler.java
1 package org.simantics.document.swt.core.widget;
2
3 import org.eclipse.core.commands.AbstractHandler;
4 import org.eclipse.core.commands.ExecutionEvent;
5 import org.eclipse.core.commands.ExecutionException;
6 import org.eclipse.jface.viewers.ISelection;
7 import org.eclipse.swt.widgets.Event;
8 import org.eclipse.swt.widgets.Widget;
9 import org.eclipse.ui.handlers.HandlerUtil;
10 import org.simantics.document.swt.core.widget.SCLTextEditor.State;
11
12 public class SCLTextEditorSaveHandler extends AbstractHandler {
13
14     @Override
15     public Object execute(ExecutionEvent event) throws ExecutionException {
16         
17         Object trigger = event.getTrigger();
18         if(trigger instanceof Event) {
19                 Event e = (Event)trigger;
20                 Widget widget = e.widget;
21                 State data = (State)widget.getData("state");
22                 if(data != null)
23                         data.fireText();
24         }
25         
26         return null;
27         
28         }
29         
30 }