Revision 51feebec
Added by Patrick Plitzner almost 8 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/datasource/CdmDataSourceViewPart.java | ||
---|---|---|
14 | 14 |
import java.util.List; |
15 | 15 |
|
16 | 16 |
import org.apache.log4j.Logger; |
17 |
import org.eclipse.core.commands.Command; |
|
18 |
import org.eclipse.core.commands.ExecutionException; |
|
19 |
import org.eclipse.core.commands.NotEnabledException; |
|
20 |
import org.eclipse.core.commands.NotHandledException; |
|
21 |
import org.eclipse.core.commands.common.NotDefinedException; |
|
22 | 17 |
import org.eclipse.core.runtime.IProgressMonitor; |
23 | 18 |
import org.eclipse.core.runtime.IStatus; |
24 | 19 |
import org.eclipse.core.runtime.Status; |
25 | 20 |
import org.eclipse.core.runtime.jobs.Job; |
26 | 21 |
import org.eclipse.jface.action.GroupMarker; |
27 | 22 |
import org.eclipse.jface.action.MenuManager; |
28 |
import org.eclipse.jface.viewers.DoubleClickEvent; |
|
29 |
import org.eclipse.jface.viewers.IDoubleClickListener; |
|
30 |
import org.eclipse.jface.viewers.StructuredSelection; |
|
31 | 23 |
import org.eclipse.jface.viewers.StructuredViewer; |
32 | 24 |
import org.eclipse.jface.viewers.TableViewer; |
33 | 25 |
import org.eclipse.jface.viewers.TableViewerColumn; |
... | ... | |
43 | 35 |
import org.eclipse.swt.widgets.TableColumn; |
44 | 36 |
import org.eclipse.ui.IMemento; |
45 | 37 |
import org.eclipse.ui.IWorkbenchActionConstants; |
46 |
import org.eclipse.ui.commands.ICommandService; |
|
47 |
import org.eclipse.ui.handlers.IHandlerService; |
|
48 | 38 |
import org.eclipse.ui.part.ViewPart; |
49 | 39 |
import org.eclipse.ui.progress.IWorkbenchSiteProgressService; |
50 | 40 |
|
... | ... | |
53 | 43 |
import eu.etaxonomy.taxeditor.datasource.CdmDataSourceRepository; |
54 | 44 |
import eu.etaxonomy.taxeditor.model.ContextListenerAdapter; |
55 | 45 |
import eu.etaxonomy.taxeditor.model.IContextListener; |
56 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
|
57 | 46 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
58 |
import eu.etaxonomy.taxeditor.store.StoreUtil; |
|
59 | 47 |
|
60 | 48 |
/** |
61 | 49 |
* <p>CdmDataSourceViewPart class.</p> |
... | ... | |
225 | 213 |
Menu menu = menuMgr.createContextMenu(control); |
226 | 214 |
control.setMenu(menu); |
227 | 215 |
|
228 |
// connect on doubleclick |
|
229 |
viewer.addDoubleClickListener(new IDoubleClickListener() { |
|
230 |
|
|
231 |
@Override |
|
232 |
public void doubleClick(DoubleClickEvent event) { |
|
233 |
if (event.getSelection() instanceof StructuredSelection) { |
|
234 |
|
|
235 |
Object element = ((StructuredSelection) event |
|
236 |
.getSelection()).getFirstElement(); |
|
237 |
if (element instanceof CdmMetaDataAwareDataSourceContainer) { |
|
238 |
String commandId = "eu.etaxonomy.taxeditor.store.datasource.change"; //$NON-NLS-1$ |
|
239 |
|
|
240 |
ICommandService commandService = (ICommandService)getSite().getService(ICommandService.class); |
|
241 |
|
|
242 |
Command command = commandService.getCommand(commandId); |
|
243 |
if(command.isEnabled()) { |
|
244 |
|
|
245 |
IHandlerService handlerService = (IHandlerService) StoreUtil.getService(IHandlerService.class); |
|
246 |
|
|
247 |
try { |
|
248 |
handlerService.executeCommand(commandId, null); |
|
249 |
} catch (ExecutionException e) { |
|
250 |
MessagingUtils.error(this.getClass(), e); |
|
251 |
} catch (NotDefinedException e) { |
|
252 |
MessagingUtils.error(this.getClass(), e); |
|
253 |
} catch (NotEnabledException e) { |
|
254 |
MessagingUtils.error(this.getClass(), e); |
|
255 |
} catch (NotHandledException e) { |
|
256 |
MessagingUtils.error(this.getClass(), e); |
|
257 |
} |
|
258 |
} |
|
259 |
} |
|
260 |
} |
|
261 |
} |
|
262 |
}); |
|
263 |
|
|
264 | 216 |
refresh(); |
265 | 217 |
} |
266 | 218 |
|
Also available in: Unified diff
Remove double click listener #5758