List of usage examples for org.eclipse.jface.databinding.swt WidgetProperties selection
public static IWidgetValueProperty selection()
From source file:org.fusesource.ide.sap.ui.properties.uicreator.OptionalServerDataUICreator.java
License:Open Source License
@Override public void initDataBindings(DataBindingContext bindingContext, EditingDomain editingDomain, ServerDataStoreEntryImpl serverDataStoreEntry) { ////from w w w . ja v a2 s .c om IObservableValue observeSelectionTraceBtnObserveWidget = WidgetProperties.selection().observe(traceBtn); IObservableValue managedConnectionFactoryTraceObserveValue = EMFEditProperties .value(editingDomain, FeaturePath.fromList(Literals.SERVER_DATA_STORE_ENTRY__VALUE, Literals.SERVER_DATA__TRACE)) .observe(serverDataStoreEntry); UpdateValueStrategy traceStrategy = new UpdateValueStrategy(); traceStrategy.setConverter(new Boolean2StringConverter()); UpdateValueStrategy traceModelStrategy = new UpdateValueStrategy(); traceModelStrategy.setConverter(new String2BooleanConverter()); bindingContext.bindValue(observeSelectionTraceBtnObserveWidget, managedConnectionFactoryTraceObserveValue, traceStrategy, traceModelStrategy); // IObservableValue observeTextSapRouterTextObserveWidget = WidgetProperties.text(SWT.Modify) .observeDelayed(300, saprouterText); IObservableValue serverDataSapRouterObserveValue = EMFEditProperties.value(editingDomain, FeaturePath.fromList(Literals.SERVER_DATA_STORE_ENTRY__VALUE, Literals.SERVER_DATA__SAPROUTER)) .observe(serverDataStoreEntry); UpdateValueStrategy sapRouterStrategy = new UpdateValueStrategy(); sapRouterStrategy.setBeforeSetValidator(new SapRouterStringValidator()); Binding saprouterBinding = bindingContext.bindValue(observeTextSapRouterTextObserveWidget, serverDataSapRouterObserveValue, sapRouterStrategy, null); // IObservableValue observeTextWorkerThreadCountTextObserveWidget = WidgetProperties.text(SWT.Modify) .observeDelayed(300, workerThreadCountText); IObservableValue serverDataWorkerThreadCountObserveValue = EMFEditProperties .value(editingDomain, FeaturePath.fromList(Literals.SERVER_DATA_STORE_ENTRY__VALUE, Literals.SERVER_DATA__WORKER_THREAD_COUNT)) .observe(serverDataStoreEntry); UpdateValueStrategy workerThreadCountStrategy = new UpdateValueStrategy(); workerThreadCountStrategy.setBeforeSetValidator( new NonNegativeIntegerValidator(Messages.OptionalServerPropertySection_WorkerThreadCountValidator)); Binding workerThreadCountBinding = bindingContext.bindValue(observeTextWorkerThreadCountTextObserveWidget, serverDataWorkerThreadCountObserveValue, workerThreadCountStrategy, null); // IObservableValue observeTextWorkerThreadMinCountTextObserveWidget = WidgetProperties.text(SWT.Modify) .observeDelayed(300, workerThreadMinCountText); IObservableValue serverDataWorkerThreadMinCountObserveValue = EMFEditProperties .value(editingDomain, FeaturePath.fromList(Literals.SERVER_DATA_STORE_ENTRY__VALUE, Literals.SERVER_DATA__WORKER_THREAD_MIN_COUNT)) .observe(serverDataStoreEntry); UpdateValueStrategy workerThreadMinCountStrategy = new UpdateValueStrategy(); workerThreadMinCountStrategy.setBeforeSetValidator(new NonNegativeIntegerValidator( Messages.OptionalServerPropertySection_WorkerThreadMinCountValidator)); Binding workerThreadMinCountBinding = bindingContext.bindValue( observeTextWorkerThreadMinCountTextObserveWidget, serverDataWorkerThreadMinCountObserveValue, workerThreadMinCountStrategy, null); // IObservableValue observeTextMaxStartupDelayTextObserveWidget = WidgetProperties.text(SWT.Modify) .observeDelayed(300, maxStartupDelayText); IObservableValue serverDataMaxStartupDelayObserveValue = EMFEditProperties.value(editingDomain, FeaturePath .fromList(Literals.SERVER_DATA_STORE_ENTRY__VALUE, Literals.SERVER_DATA__MAX_START_UP_DELAY)) .observe(serverDataStoreEntry); UpdateValueStrategy maxStartupDelayStrategy = new UpdateValueStrategy(); maxStartupDelayStrategy.setBeforeSetValidator( new NonNegativeIntegerValidator(Messages.OptionalServerPropertySection_MaxStartupDelayValidator)); Binding maxStartupDelayBinding = bindingContext.bindValue(observeTextMaxStartupDelayTextObserveWidget, serverDataMaxStartupDelayObserveValue, maxStartupDelayStrategy, null); // IObservableValue observeRepositoryMapTextObserveWidget = WidgetProperties.text(SWT.Modify) .observeDelayed(300, repositoryMapText); IObservableValue serverRepositoryMapObserveValue = EMFEditProperties.value(editingDomain, FeaturePath.fromList(Literals.SERVER_DATA_STORE_ENTRY__VALUE, Literals.SERVER_DATA__REPOSITORY_MAP)) .observe(serverDataStoreEntry); bindingContext.bindValue(observeRepositoryMapTextObserveWidget, serverRepositoryMapObserveValue); ControlDecorationSupport.create(saprouterBinding, SWT.TOP | SWT.LEFT); ControlDecorationSupport.create(workerThreadCountBinding, SWT.TOP | SWT.LEFT); ControlDecorationSupport.create(workerThreadMinCountBinding, SWT.TOP | SWT.LEFT); ControlDecorationSupport.create(maxStartupDelayBinding, SWT.TOP | SWT.LEFT); }
From source file:org.fusesource.ide.sap.ui.properties.uicreator.RepositoryDestinationDataUICreator.java
License:Open Source License
@Override public void initDataBindings(DataBindingContext bindingContext, EditingDomain editingDomain, DestinationDataStoreEntryImpl destinationDataStoreEntry) { ////from www . ja v a 2 s. com IObservableValue observeTextRepositoryDestinationTextObserveWidget = WidgetProperties.text(SWT.Modify) .observeDelayed(300, repositoryDestinationText); IObservableValue managedConnectionFactoryRepositoryDestObserveValue = EMFEditProperties .value(editingDomain, FeaturePath.fromList(Literals.DESTINATION_DATA_STORE_ENTRY__VALUE, Literals.DESTINATION_DATA__REPOSITORY_DEST)) .observe(destinationDataStoreEntry); bindingContext.bindValue(observeTextRepositoryDestinationTextObserveWidget, managedConnectionFactoryRepositoryDestObserveValue); // IObservableValue observeTextRepositoryUserTextObserveWidget = WidgetProperties.text(SWT.Modify) .observeDelayed(300, repositoryUserText); IObservableValue managedConnectionFactoryRepositoryUserObserveValue = EMFEditProperties .value(editingDomain, FeaturePath.fromList(Literals.DESTINATION_DATA_STORE_ENTRY__VALUE, Literals.DESTINATION_DATA__REPOSITORY_USER)) .observe(destinationDataStoreEntry); bindingContext.bindValue(observeTextRepositoryUserTextObserveWidget, managedConnectionFactoryRepositoryUserObserveValue); // IObservableValue observeTextRepositoryPasswordTextObserveWidget = WidgetProperties.text(SWT.Modify) .observeDelayed(300, repositoryPasswordText); IObservableValue managedConnectionFactoryRepositoryPasswdObserveValue = EMFEditProperties .value(editingDomain, FeaturePath.fromList(Literals.DESTINATION_DATA_STORE_ENTRY__VALUE, Literals.DESTINATION_DATA__REPOSITORY_PASSWD)) .observe(destinationDataStoreEntry); bindingContext.bindValue(observeTextRepositoryPasswordTextObserveWidget, managedConnectionFactoryRepositoryPasswdObserveValue); // IObservableValue observeSelectionRespositorySncBtnObserveWidget = WidgetProperties.selection() .observe(respositorySncBtn); IObservableValue managedConnectionFactoryRepositorySncObserveValue = EMFEditProperties .value(editingDomain, FeaturePath.fromList(Literals.DESTINATION_DATA_STORE_ENTRY__VALUE, Literals.DESTINATION_DATA__REPOSITORY_SNC)) .observe(destinationDataStoreEntry); UpdateValueStrategy strategy_15 = new UpdateValueStrategy(); strategy_15.setConverter(new Boolean2StringConverter()); UpdateValueStrategy repositorySncModelStrategy = new UpdateValueStrategy(); repositorySncModelStrategy.setConverter(new String2BooleanConverter()); bindingContext.bindValue(observeSelectionRespositorySncBtnObserveWidget, managedConnectionFactoryRepositorySncObserveValue, strategy_15, repositorySncModelStrategy); // IObservableValue observeSelectionRepositoryRoundtripOptimizationBtnObserveWidget = WidgetProperties .selection().observe(repositoryRoundtripOptimizationBtn); IObservableValue managedConnectionFactoryRepositoryRoundtripOptimizationObserveValue = EMFEditProperties .value(editingDomain, FeaturePath.fromList(Literals.DESTINATION_DATA_STORE_ENTRY__VALUE, Literals.DESTINATION_DATA__REPOSITORY_ROUNDTRIP_OPTIMIZATION)) .observe(destinationDataStoreEntry); UpdateValueStrategy strategy_16 = new UpdateValueStrategy(); strategy_16.setConverter(new Boolean2StringConverter()); UpdateValueStrategy repositoryRoundtripOptimizationModelStrategy = new UpdateValueStrategy(); repositoryRoundtripOptimizationModelStrategy.setConverter(new String2BooleanConverter()); bindingContext.bindValue(observeSelectionRepositoryRoundtripOptimizationBtnObserveWidget, managedConnectionFactoryRepositoryRoundtripOptimizationObserveValue, strategy_16, repositoryRoundtripOptimizationModelStrategy); }
From source file:org.fusesource.ide.sap.ui.properties.uicreator.SncDestinationDataUICreator.java
License:Open Source License
@Override public void initDataBindings(DataBindingContext bindingContext, EditingDomain editingDomain, DestinationDataStoreEntryImpl destinationDataStoreEntry) { ///* w w w. j a v a2s .co m*/ IObservableValue observeSelectionSncModeBtnObserveWidget = WidgetProperties.selection().observe(sncModeBtn); IObservableValue managedConnectionFactorySncModeObserveValue = EMFEditProperties .value(editingDomain, FeaturePath.fromList(Literals.DESTINATION_DATA_STORE_ENTRY__VALUE, Literals.DESTINATION_DATA__SNC_MODE)) .observe(destinationDataStoreEntry); UpdateValueStrategy strategy_13 = new UpdateValueStrategy(); strategy_13.setConverter(new Boolean2StringConverter()); UpdateValueStrategy sncModeModelStrategy = new UpdateValueStrategy(); sncModeModelStrategy.setConverter(new String2BooleanConverter()); bindingContext.bindValue(observeSelectionSncModeBtnObserveWidget, managedConnectionFactorySncModeObserveValue, strategy_13, sncModeModelStrategy); // IObservableValue observeTextSncPartnernameTextObserveWidget = WidgetProperties.text(SWT.Modify) .observeDelayed(300, sncPartnernameText); IObservableValue managedConnectionFactorySncPartnernameObserveValue = EMFEditProperties .value(editingDomain, FeaturePath.fromList(Literals.DESTINATION_DATA_STORE_ENTRY__VALUE, Literals.DESTINATION_DATA__SNC_PARTNERNAME)) .observe(destinationDataStoreEntry); bindingContext.bindValue(observeTextSncPartnernameTextObserveWidget, managedConnectionFactorySncPartnernameObserveValue); // IObservableValue observeSingleSelectionIndexSncQopComboObserveWidget = WidgetProperties .singleSelectionIndex().observe(sncQopCombo); IObservableValue managedConnectionFactorySncQopObserveValue = EMFEditProperties .value(editingDomain, FeaturePath.fromList(Literals.DESTINATION_DATA_STORE_ENTRY__VALUE, Literals.DESTINATION_DATA__SNC_QOP)) .observe(destinationDataStoreEntry); UpdateValueStrategy strategy_14 = new UpdateValueStrategy(); strategy_14.setConverter(new SncQosComboSelection2SncQosConverter()); UpdateValueStrategy sncQopModelStrategy = new UpdateValueStrategy(); sncQopModelStrategy.setConverter(new SncQos2SncQosComboSelectionConverter()); bindingContext.bindValue(observeSingleSelectionIndexSncQopComboObserveWidget, managedConnectionFactorySncQopObserveValue, strategy_14, sncQopModelStrategy); // IObservableValue observeTextSncMynameTextObserveWidget = WidgetProperties.text(SWT.Modify) .observeDelayed(300, sncMynameText); IObservableValue managedConnectionFactorySncMynameObserveValue = EMFEditProperties .value(editingDomain, FeaturePath.fromList(Literals.DESTINATION_DATA_STORE_ENTRY__VALUE, Literals.DESTINATION_DATA__SNC_MYNAME)) .observe(destinationDataStoreEntry); bindingContext.bindValue(observeTextSncMynameTextObserveWidget, managedConnectionFactorySncMynameObserveValue); // IObservableValue observeTextSncLibraryTextObserveWidget = WidgetProperties.text(SWT.Modify) .observeDelayed(300, sncLibraryText); IObservableValue managedConnectionFactorySncLibraryObserveValue = EMFEditProperties .value(editingDomain, FeaturePath.fromList(Literals.DESTINATION_DATA_STORE_ENTRY__VALUE, Literals.DESTINATION_DATA__SNC_LIBRARY)) .observe(destinationDataStoreEntry); bindingContext.bindValue(observeTextSncLibraryTextObserveWidget, managedConnectionFactorySncLibraryObserveValue); }
From source file:org.fusesource.ide.sap.ui.properties.uicreator.SncServerDataUICreator.java
License:Open Source License
@Override public void initDataBindings(DataBindingContext bindingContext, EditingDomain editingDomain, ServerDataStoreEntryImpl serverDataStoreEntry) { ////from ww w . ja v a2 s .com IObservableValue observeSelectionSncModeBtnObserveWidget = WidgetProperties.selection().observe(sncModeBtn); IObservableValue managedConnectionFactorySncModeObserveValue = EMFEditProperties.value(editingDomain, FeaturePath.fromList(Literals.SERVER_DATA_STORE_ENTRY__VALUE, Literals.SERVER_DATA__SNC_MODE)) .observe(serverDataStoreEntry); UpdateValueStrategy strategy_13 = new UpdateValueStrategy(); strategy_13.setConverter(new Boolean2StringConverter()); UpdateValueStrategy sncModeModelStrategy = new UpdateValueStrategy(); sncModeModelStrategy.setConverter(new String2BooleanConverter()); bindingContext.bindValue(observeSelectionSncModeBtnObserveWidget, managedConnectionFactorySncModeObserveValue, strategy_13, sncModeModelStrategy); // IObservableValue observeSingleSelectionIndexSncQopComboObserveWidget = WidgetProperties .singleSelectionIndex().observe(sncQopCombo); IObservableValue managedConnectionFactorySncQopObserveValue = EMFEditProperties.value(editingDomain, FeaturePath.fromList(Literals.SERVER_DATA_STORE_ENTRY__VALUE, Literals.SERVER_DATA__SNC_QOP)) .observe(serverDataStoreEntry); UpdateValueStrategy sncQopStategy = new UpdateValueStrategy(); sncQopStategy.setConverter(new SncQosComboSelection2SncQosConverter()); UpdateValueStrategy sncQopModelStrategy = new UpdateValueStrategy(); sncQopModelStrategy.setConverter(new SncQos2SncQosComboSelectionConverter()); bindingContext.bindValue(observeSingleSelectionIndexSncQopComboObserveWidget, managedConnectionFactorySncQopObserveValue, sncQopStategy, sncQopModelStrategy); // IObservableValue observeTextSncMynameTextObserveWidget = WidgetProperties.text(SWT.Modify) .observeDelayed(300, sncMynameText); IObservableValue managedConnectionFactorySncMynameObserveValue = EMFEditProperties.value(editingDomain, FeaturePath.fromList(Literals.SERVER_DATA_STORE_ENTRY__VALUE, Literals.SERVER_DATA__SNC_MYNAME)) .observe(serverDataStoreEntry); bindingContext.bindValue(observeTextSncMynameTextObserveWidget, managedConnectionFactorySncMynameObserveValue); // IObservableValue observeTextSncLibraryTextObserveWidget = WidgetProperties.text(SWT.Modify) .observeDelayed(300, sncLibraryText); IObservableValue managedConnectionFactorySncLibraryObserveValue = EMFEditProperties.value(editingDomain, FeaturePath.fromList(Literals.SERVER_DATA_STORE_ENTRY__VALUE, Literals.SERVER_DATA__SNC_LIB)) .observe(serverDataStoreEntry); bindingContext.bindValue(observeTextSncLibraryTextObserveWidget, managedConnectionFactorySncLibraryObserveValue); }
From source file:org.fusesource.ide.sap.ui.properties.uicreator.SpecialDestinationDataUICreator.java
License:Open Source License
@Override public void initDataBindings(DataBindingContext bindingContext, EditingDomain editingDomain, DestinationDataStoreEntryImpl destinationDataStoreEntry) { ///*from ww w.j a v a 2s.c o m*/ IObservableValue observeSelectionTraceBtnObserveWidget = WidgetProperties.selection().observe(traceBtn); IObservableValue managedConnectionFactoryTraceObserveValue = EMFEditProperties .value(editingDomain, FeaturePath.fromList(Literals.DESTINATION_DATA_STORE_ENTRY__VALUE, Literals.DESTINATION_DATA__TRACE)) .observe(destinationDataStoreEntry); UpdateValueStrategy traceStrategy = new UpdateValueStrategy(); traceStrategy.setConverter(new Boolean2StringConverter()); UpdateValueStrategy traceModelStrategy = new UpdateValueStrategy(); traceModelStrategy.setConverter(new String2BooleanConverter()); bindingContext.bindValue(observeSelectionTraceBtnObserveWidget, managedConnectionFactoryTraceObserveValue, traceStrategy, traceModelStrategy); // IObservableValue observeSelectionCpicTraceComboObserveWidget = WidgetProperties.singleSelectionIndex() .observe(cpicTraceCombo); IObservableValue managedConnectionFactoryCpicTraceObserveValue = EMFEditProperties .value(editingDomain, FeaturePath.fromList(Literals.DESTINATION_DATA_STORE_ENTRY__VALUE, Literals.DESTINATION_DATA__CPIC_TRACE)) .observe(destinationDataStoreEntry); UpdateValueStrategy strategy_4 = new UpdateValueStrategy(); strategy_4.setConverter(new CpicTraceComboSelection2TraceLevelConverter()); UpdateValueStrategy cpicTraceStrategy = new UpdateValueStrategy(); cpicTraceStrategy.setConverter(new TraceLevel2CpicTraceComboSelectionConverter()); bindingContext.bindValue(observeSelectionCpicTraceComboObserveWidget, managedConnectionFactoryCpicTraceObserveValue, strategy_4, cpicTraceStrategy); // IObservableValue observeSelectionLcheckBtnObserveWidget = WidgetProperties.selection().observe(lcheckBtn); IObservableValue managedConnectionFactoryLcheckObserveValue = EMFEditProperties .value(editingDomain, FeaturePath.fromList(Literals.DESTINATION_DATA_STORE_ENTRY__VALUE, Literals.DESTINATION_DATA__LCHECK)) .observe(destinationDataStoreEntry); UpdateValueStrategy strategy_5 = new UpdateValueStrategy(); strategy_5.setConverter(new Boolean2StringConverter()); UpdateValueStrategy lcheckModelStrategy = new UpdateValueStrategy(); lcheckModelStrategy.setConverter(new String2BooleanConverter()); bindingContext.bindValue(observeSelectionLcheckBtnObserveWidget, managedConnectionFactoryLcheckObserveValue, strategy_5, lcheckModelStrategy); // IObservableValue observeTextCodepageTextObserveWidget = WidgetProperties.text(SWT.Modify) .observeDelayed(300, codepageText); IObservableValue managedConnectionFactoryCodepageObserveValue = EMFEditProperties .value(editingDomain, FeaturePath.fromList(Literals.DESTINATION_DATA_STORE_ENTRY__VALUE, Literals.DESTINATION_DATA__CODEPAGE)) .observe(destinationDataStoreEntry); bindingContext.bindValue(observeTextCodepageTextObserveWidget, managedConnectionFactoryCodepageObserveValue); // IObservableValue observeSelectionGetsso2BtnObserveWidget = WidgetProperties.selection().observe(getsso2Btn); IObservableValue managedConnectionFactoryGetsso2ObserveValue = EMFEditProperties .value(editingDomain, FeaturePath.fromList(Literals.DESTINATION_DATA_STORE_ENTRY__VALUE, Literals.DESTINATION_DATA__GETSSO2)) .observe(destinationDataStoreEntry); UpdateValueStrategy strategy_6 = new UpdateValueStrategy(); strategy_6.setConverter(new Boolean2StringConverter()); UpdateValueStrategy getssoModelStrategy = new UpdateValueStrategy(); getssoModelStrategy.setConverter(new String2BooleanConverter()); bindingContext.bindValue(observeSelectionGetsso2BtnObserveWidget, managedConnectionFactoryGetsso2ObserveValue, strategy_6, getssoModelStrategy); // IObservableValue observeSelectionDenyInitialPasswordBtnObserveWidget = WidgetProperties.selection() .observe(denyInitialPasswordBtn); IObservableValue managedConnectionFactoryDenyInitialPasswordObserveValue = EMFEditProperties .value(editingDomain, FeaturePath.fromList(Literals.DESTINATION_DATA_STORE_ENTRY__VALUE, Literals.DESTINATION_DATA__DENY_INITIAL_PASSWORD)) .observe(destinationDataStoreEntry); UpdateValueStrategy strategy_7 = new UpdateValueStrategy(); strategy_7.setConverter(new Boolean2StringConverter()); UpdateValueStrategy denyInitialPasswordModelStrategy = new UpdateValueStrategy(); denyInitialPasswordModelStrategy.setConverter(new String2BooleanConverter()); bindingContext.bindValue(observeSelectionDenyInitialPasswordBtnObserveWidget, managedConnectionFactoryDenyInitialPasswordObserveValue, strategy_7, denyInitialPasswordModelStrategy); }
From source file:org.goko.common.bindings.AbstractController.java
License:Open Source License
public void addSelectionBinding(Object target, String property) throws GkException { verifyGetter(dataModel, property);/*from w ww.ja v a 2 s. c om*/ verifySetter(dataModel, property); IObservableValue observeSelectionBtnCheckButtonObserveWidget = WidgetProperties.selection().observe(target); IObservableValue enabledBindingsObserveValue = BeanProperties.value(property).observe(dataModel); bindingContext.bindValue(observeSelectionBtnCheckButtonObserveWidget, enabledBindingsObserveValue, null, null); }
From source file:org.goko.common.bindings.AbstractController.java
License:Open Source License
/** * Binding between a button and a property, based on selection * @param source the UI object/* w ww . j ava2 s. c om*/ * @param property the name of the property * @throws GkException GkException */ public void addCheckboxSelectionBinding(Button button, String property) { IObservableValue widgetValue = WidgetProperties.selection().observe(button); IObservableValue modelValue = BeansObservables.observeValue(dataModel, property); Binding binding = bindingContext.bindValue(widgetValue, modelValue); bindings.add(binding); }
From source file:org.goko.viewer.jogl.GCodeViewer3D.java
License:Open Source License
@PostConstruct public void createPartControl(Composite superCompositeParent, IEclipseContext context, MPart part) throws GkException { Composite compositeParent = new Composite(superCompositeParent, SWT.NONE); GLData gldata = new GLData(); gldata.doubleBuffer = true;// w w w.ja v a 2 s. c o m GridLayout gl_compositeParent = new GridLayout(1, false); gl_compositeParent.verticalSpacing = 0; gl_compositeParent.marginWidth = 0; gl_compositeParent.marginHeight = 0; compositeParent.setLayout(gl_compositeParent); final ToolBar toolBar = new ToolBar(compositeParent, SWT.FLAT | SWT.RIGHT); glcanvas = viewerService.createCanvas(compositeParent); final ToolItem btnEnableView = new ToolItem(toolBar, SWT.CHECK); btnEnableView.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { getController().setRenderEnabled(btnEnableView.getSelection()); } }); btnEnableView.setToolTipText("Enable/disable 3D view"); btnEnableView.setWidth(32); btnEnableView.setHotImage( ResourceManager.getPluginImage("org.goko.gcode.viewer", "resources/icons/activated.png")); btnEnableView .setImage(ResourceManager.getPluginImage("org.goko.gcode.viewer", "resources/icons/activated.png")); final ToolItem btnEnableGrid = new ToolItem(toolBar, SWT.CHECK); btnEnableGrid.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { try { getController().setShowGrid(btnEnableGrid.getSelection()); } catch (GkException ex) { displayError(ex); } } }); btnEnableGrid.setToolTipText("Show/hide grid"); btnEnableGrid.setImage(ResourceManager.getPluginImage("org.goko.gcode.viewer", "resources/icons/grid.png")); getController().addSelectionBinding(btnEnableGrid, "showGrid"); final ToolItem btnEnableBounds = new ToolItem(toolBar, SWT.CHECK); btnEnableBounds.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { try { getController().setDisplayBounds(btnEnableBounds.getSelection()); } catch (GkException ex) { displayError(ex); } } }); btnEnableBounds.setToolTipText("Show/hide bounds"); btnEnableBounds.setImage( ResourceManager.getPluginImage("org.goko.gcode.viewer", "resources/icons/show-bound.png")); getController().addSelectionBinding(btnEnableBounds, "enabled"); getController().addSelectionBinding(btnEnableView, "enabled"); final ICoordinateSystemAdapter csAdapter = viewerService.getCoordinateSystemAdapter(); if (csAdapter != null) { final Menu coordinateSystemMenu = new Menu(toolBar.getShell(), SWT.POP_UP); final MenuItem csItemAll = new MenuItem(coordinateSystemMenu, SWT.PUSH); csItemAll.setText("Show all"); csItemAll.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { try { for (final EnumCoordinateSystem cs : csAdapter.getCoordinateSystem()) { viewerService.setCoordinateSystemEnabled(cs, true); getDataModel().getCoordinateSystemEnabled().put(cs.name(), true); } } catch (GkException e1) { displayError(e1); } }; }); MenuItem csItemNone = new MenuItem(coordinateSystemMenu, SWT.PUSH); csItemNone.setText("Hide all"); csItemNone.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { try { for (final EnumCoordinateSystem cs : csAdapter.getCoordinateSystem()) { viewerService.setCoordinateSystemEnabled(cs, false); getDataModel().getCoordinateSystemEnabled().put(cs.name(), false); } } catch (GkException e1) { displayError(e1); } }; }); MenuItem csItemSeparator = new MenuItem(coordinateSystemMenu, SWT.SEPARATOR); // Create the menu for CS display for (final EnumCoordinateSystem cs : csAdapter.getCoordinateSystem()) { final MenuItem item = new MenuItem(coordinateSystemMenu, SWT.CHECK); item.setText(cs.name()); viewerService.setCoordinateSystemEnabled(cs, true); getDataModel().getCoordinateSystemEnabled().put(cs.name(), true); item.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { viewerService.setCoordinateSystemEnabled(cs, item.getSelection()); getDataModel().getCoordinateSystemEnabled().put(cs.name(), item.getSelection()); }; }); { IObservableValue modelObservable = Observables .observeMapEntry(getDataModel().getCoordinateSystemEnabled(), cs.name()); IObservableValue controlObservable = WidgetProperties.selection().observe(item); UpdateValueStrategy policy = new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE); getController().getBindingContext().bindValue(controlObservable, modelObservable, null, policy); } } final ToolItem tltmDropdownItem = new ToolItem(toolBar, SWT.DROP_DOWN); tltmDropdownItem.setToolTipText("Show/hide coordinates systems"); tltmDropdownItem.setImage( ResourceManager.getPluginImage("org.goko.gcode.viewer", "resources/icons/show-cs.png")); tltmDropdownItem.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event event) { Rectangle rect = tltmDropdownItem.getBounds(); Point pt = new Point(rect.x, rect.y + rect.height); pt = toolBar.toDisplay(pt); coordinateSystemMenu.setLocation(pt.x, pt.y); coordinateSystemMenu.setVisible(true); } }); } ToolItem toolItem = new ToolItem(toolBar, SWT.SEPARATOR); ToolItem btnZoomExtent = new ToolItem(toolBar, SWT.NONE); btnZoomExtent.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { try { getController().zoomToFit(); } catch (GkException ex) { displayError(ex); } } }); btnZoomExtent.setToolTipText("Zoom extents"); btnZoomExtent.setWidth(32); btnZoomExtent.setImage( ResourceManager.getPluginImage("org.goko.gcode.viewer", "resources/icons/layer-resize.png")); final ToolItem btnView = new ToolItem(toolBar, SWT.DROP_DOWN); btnView.setImage( ResourceManager.getPluginImage("org.goko.gcode.viewer", "resources/icons/projection-screen.png")); btnView.setToolTipText("Change view"); final Menu viewMenu = new Menu(toolBar.getShell(), SWT.POP_UP); for (AbstractCamera camera : viewerService.getSupportedCamera()) { MenuItem btnCamera = new MenuItem(viewMenu, SWT.PUSH); btnCamera.setText(camera.getLabel()); final String cameraId = camera.getId(); btnCamera.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { try { viewerService.setActiveCamera(cameraId); } catch (GkException e1) { displayError(e1); } } }); } btnView.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event event) { Rectangle rect = btnView.getBounds(); Point pt = new Point(rect.x, rect.y + rect.height); pt = toolBar.toDisplay(pt); viewMenu.setLocation(pt.x, pt.y); viewMenu.setVisible(true); } }); ToolItem toolItem_1 = new ToolItem(toolBar, SWT.SEPARATOR); final ToolItem btnKeyboardJog = new ToolItem(toolBar, SWT.CHECK); btnKeyboardJog.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { glcanvas.setKeyboardJogEnabled(btnKeyboardJog.getSelection()); } }); btnKeyboardJog.setToolTipText("Enable/disable keyboard jogging"); btnKeyboardJog.setImage( ResourceManager.getPluginImage("org.goko.gcode.viewer", "resources/icons/keyboard--arrow.png")); glcanvas.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); animator = new Animator(); animator.add(glcanvas); animator.start(); ContextInjectionFactory.inject(glcanvas, context); // glcanvas.setMenu(initContextualMenu(composite)); Map<String, String> state = part.getPersistedState(); String viewerEnabledStr = state.get(VIEWER_ENABLED); if (StringUtils.isNotEmpty(viewerEnabledStr)) { getDataModel().setEnabled(BooleanUtils.toBoolean(viewerEnabledStr)); getController().setRenderEnabled(BooleanUtils.toBoolean(viewerEnabledStr)); } String gridEnabledStr = state.get(VIEWER_GRID_ENABLED); if (StringUtils.isNotEmpty(gridEnabledStr)) { getDataModel().setShowGrid(BooleanUtils.toBoolean(gridEnabledStr)); getController().setShowGrid(BooleanUtils.toBoolean(gridEnabledStr)); } String lockCameraToolStr = state.get(VIEWER_LOCK_CAMERA_ON_TOOL); if (StringUtils.isNotEmpty(lockCameraToolStr)) { getDataModel().setFollowTool(BooleanUtils.toBoolean(lockCameraToolStr)); getController().setLockCameraOnTool(BooleanUtils.toBoolean(lockCameraToolStr)); } String csEnabledStr = state.get(VIEWER_COORDINATE_SYSTEM_ENABLED); if (StringUtils.isNotEmpty(csEnabledStr)) { getDataModel().setShowCoordinateSystem(BooleanUtils.toBoolean(csEnabledStr)); getController().setShowCoordinateSystem(BooleanUtils.toBoolean(csEnabledStr)); } }
From source file:org.jboss.tools.common.launcher.ui.wizard.NewLauncherProjectWizardPage.java
License:Open Source License
@Override protected void doCreateControls(final Composite parent, DataBindingContext dbc) { GridLayoutFactory.fillDefaults().margins(6, 6).numColumns(2).applyTo(parent); // explanation Label explanation = new Label(parent, SWT.WRAP); explanation.setText("Launcher will generate an application for you." + " By picking a mission you determine what this application will do." + " The runtime then picks the software stack that's used to implement this aim."); GridDataFactory.fillDefaults().span(2, 1).align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(explanation); // missions/*from w w w .j av a 2s . co m*/ Label lblMissions = new Label(parent, SWT.NONE); lblMissions.setText("Mission:"); lblMissions.setToolTipText("A specification that describes what your application will do."); GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(lblMissions); Combo comboMissions = new Combo(parent, SWT.SINGLE | SWT.DROP_DOWN | SWT.READ_ONLY); GridDataFactory.fillDefaults().indent(0, 10).align(SWT.LEFT, SWT.CENTER).hint(300, SWT.DEFAULT) .applyTo(comboMissions); ComboViewer comboMissionsViewer = new ComboViewer(comboMissions); comboMissionsViewer.setContentProvider(new ObservableListContentProvider()); comboMissionsViewer.setInput(BeanProperties.list(NewLauncherProjectModel.MISSIONS_PROPERTY).observe(model)); comboMissionsViewer.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { Mission mission = (Mission) element; return mission.getId(); } }); IObservableValue selectedMissionObservable = BeanProperties .value(NewLauncherProjectModel.SELECTED_MISSION_PROPERTY).observe(model); ValueBindingBuilder.bind(ViewerProperties.singleSelection().observe(comboMissionsViewer)) .to(selectedMissionObservable).in(dbc); new Label(parent, SWT.None); // filler StyledText missionDescription = createStyledText(parent); IObservableValue missionDescriptionObservable = PojoProperties .value(NewLauncherProjectModel.DESCRIPTION_PROPERTY).observeDetail(selectedMissionObservable); ValueBindingBuilder.bind(WidgetProperties.text().observe(missionDescription)).notUpdatingParticipant() .to(missionDescriptionObservable).in(dbc); missionDescriptionObservable.addValueChangeListener(event -> setToPreferredVerticalSize(getShell())); // boosters Label lblBoosters = new Label(parent, SWT.NONE); lblBoosters.setText("Runtime:"); lblBoosters.setToolTipText("The framework software used in the application's process."); GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(lblBoosters); Combo comboBoosters = new Combo(parent, SWT.SINGLE | SWT.DROP_DOWN | SWT.READ_ONLY); GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).hint(300, SWT.DEFAULT).applyTo(comboBoosters); ComboViewer comboBoostersViewer = new ComboViewer(comboBoosters); comboBoostersViewer.setContentProvider(new ObservableListContentProvider()); comboBoostersViewer.setInput(BeanProperties.list(NewLauncherProjectModel.BOOSTERS_PROPERTY).observe(model)); comboBoostersViewer.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { Booster booster = (Booster) element; return booster.getRuntime() + " " + booster.getVersion(); } }); IObservableValue<Booster> selectedBoosterObservable = BeanProperties .value(NewLauncherProjectModel.SELECTED_BOOSTER_PROPERTY).observe(model); ValueBindingBuilder.bind(ViewerProperties.singleSelection().observe(comboBoostersViewer)) .to(selectedBoosterObservable).in(dbc); new Label(parent, SWT.None); // filler StyledText boosterDescription = createStyledText(parent); IObservableValue boosterDescriptionObservable = PojoProperties .value(NewLauncherProjectModel.DESCRIPTION_PROPERTY).observeDetail(selectedBoosterObservable); ValueBindingBuilder.bind(WidgetProperties.text().observe(boosterDescription)).notUpdatingParticipant() .to(boosterDescriptionObservable).in(dbc); boosterDescriptionObservable.addValueChangeListener(event -> setToPreferredVerticalSize(getShell())); // separator Label mavenSeparator = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL); GridDataFactory.fillDefaults().span(2, 1).align(SWT.FILL, SWT.CENTER).applyTo(mavenSeparator); // project name createTextWidget(parent, dbc, "Project name:", NewLauncherProjectModel.PROJECT_NAME_PROPERTY, new EclipseProjectValidator("Please specify an Eclipse project", "Project already exists")); //use default location Button buttonUseDefaultLocation = new Button(parent, SWT.CHECK); buttonUseDefaultLocation.setText("Use default location"); GridDataFactory.fillDefaults().span(2, 1).align(SWT.LEFT, SWT.CENTER).applyTo(buttonUseDefaultLocation); IObservableValue<Boolean> useDefaultLocationButtonObservable = WidgetProperties.selection() .observe(buttonUseDefaultLocation); ValueBindingBuilder.bind(useDefaultLocationButtonObservable) .to(BeanProperties.value(NewLauncherProjectModel.USE_DEFAULT_LOCATION_PROPERTY).observe(model)) .in(dbc); // location Label lblLocation = new Label(parent, SWT.NONE); lblLocation.setText("Location:"); GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(lblLocation); Text txtLocation = new Text(parent, SWT.BORDER); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(txtLocation); Binding locationBinding = ValueBindingBuilder.bind(WidgetProperties.text(SWT.Modify).observe(txtLocation)) .validatingAfterGet(new MandatoryStringValidator("Please specify a location for you project")) .converting( IConverter.create(String.class, IPath.class, NewLauncherProjectWizardPage::string2IPath)) .to(BeanProperties.value(NewLauncherProjectModel.LOCATION_PROPERTY).observe(model)).in(dbc); ValueBindingBuilder.bind(WidgetProperties.enabled().observe(txtLocation)).notUpdatingParticipant() .to(BeanProperties.value(NewLauncherProjectModel.USE_DEFAULT_LOCATION_PROPERTY).observe(model)) .converting(new InvertingBooleanConverter()).in(dbc); ControlDecorationSupport.create(locationBinding, SWT.LEFT | SWT.TOP, null, new RequiredControlDecorationUpdater()); // separator Label launcherSeparator = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL); GridDataFactory.fillDefaults().indent(0, 10).span(2, 1).align(SWT.FILL, SWT.CENTER) .applyTo(launcherSeparator); // maven artifact Label mavenArtifactExplanation = new Label(parent, SWT.None); mavenArtifactExplanation.setText("Maven Artifact:"); GridDataFactory.fillDefaults().span(2, 1).align(SWT.FILL, SWT.CENTER).applyTo(mavenArtifactExplanation); createTextWidget(parent, dbc, "Artifact id:", NewLauncherProjectModel.ARTIFACTID_PROPERTY, new MandatoryStringValidator("Please specify an artifact id")); createTextWidget(parent, dbc, "Group id:", NewLauncherProjectModel.GROUPID_PROPERTY, new MandatoryStringValidator("Please specify a group id")); createTextWidget(parent, dbc, "Version:", NewLauncherProjectModel.VERSION_PROPERTY, new MandatoryStringValidator("Please specify a version")); loadCatalog(); }
From source file:org.jboss.tools.internal.deltacloud.ui.wizards.ManageKeysPage.java
License:Open Source License
private List createKeyList(DataBindingContext dbc, Composite container) { final List keyList = new List(container, SWT.BORDER | SWT.SINGLE | SWT.V_SCROLL); // bind items dbc.bindList(WidgetProperties.items().observe(keyList), BeanProperties.list(ManageKeysPageModel.PROP_KEYS).observe(model), new UpdateListStrategy(UpdateSetStrategy.POLICY_NEVER), new UpdateListStrategy().setConverter(new Key2IdConverter())); // bind selected key dbc.bindValue(WidgetProperties.selection().observe(keyList), BeanProperties.value(ManageKeysPageModel.PROP_SELECTED_KEY).observe(model), new UpdateValueStrategy().setConverter(new Id2KeyConverter()), new UpdateValueStrategy().setConverter(new Key2IdConverter())); keyList.addListener(SWT.MouseDoubleClick, onKeyDoubleclick()); return keyList; }