Java Code Examples for org.eclipse.swt.widgets.Control#getData()
The following examples show how to use
org.eclipse.swt.widgets.Control#getData() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BindingDialogHelper.java From birt with Eclipse Public License 1.0 | 6 votes |
protected String[] getControlValue( Control control ) { if ( control instanceof Text ) { return new String[]{ ( (Text) control ).getText( ), (String) control.getData( ExpressionButtonUtil.EXPR_TYPE ) }; } else if ( control instanceof Combo ) { return new String[]{ ( (Combo) control ).getText( ), (String) control.getData( ExpressionButtonUtil.EXPR_TYPE ) }; } return null; }
Example 2
Source File: SWTSkinObjectContainer.java From BiglyBT with GNU General Public License v2.0 | 6 votes |
private void obfuscatedImage(Composite c, Image image) { if (c == null || c.isDisposed() || !c.isVisible()) { return; } Control[] children = c.getChildren(); for (Control childControl : children) { if (!childControl.isVisible()) { continue; } ObfuscateImage oi = (ObfuscateImage) childControl.getData("ObfuscateImage"); if (oi != null) { oi.obfuscatedImage(image); continue; } if (childControl instanceof Composite) { obfuscatedImage((Composite) childControl, image); } } }
Example 3
Source File: SWTGraphicUtil.java From nebula with Eclipse Public License 2.0 | 5 votes |
/** * Enable all widgets of a control * * @param control control to enable/disable * @param enable <code>true</code> to enable, <code>false</code> to disable */ public static void enableAllChildrenWidgets(final Control control) { if (control instanceof Composite) { for (final Control c : ((Composite) control).getChildren()) { enableAllChildrenWidgets(c); } } boolean enable = true; final Boolean previousState = (Boolean) control.getData(SWTGraphicUtil.class.toString() + "_enableState"); if (previousState != null) { enable = previousState; } control.setEnabled(enable); }
Example 4
Source File: CrosstabBindingDialogHelper.java From birt with Eclipse Public License 1.0 | 5 votes |
private static ExpressionButton getExpressionButton( Control control ) { Object button = control.getData( ExpressionButtonUtil.EXPR_BUTTON ); if ( button instanceof ExpressionButton ) { return ( (ExpressionButton) button ); } return null; }
Example 5
Source File: Utilities.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
public static IWorkbenchPartSite findSite(Control c) { while (c != null && !c.isDisposed()) { Object data= c.getData(); if (data instanceof IWorkbenchPart) return ((IWorkbenchPart)data).getSite(); c= c.getParent(); } return null; }
Example 6
Source File: ExampleDropTargetInstaller.java From statecharts with Eclipse Public License 1.0 | 5 votes |
protected DropTarget findDropTarget(Control control) { Object object = control.getData(DND.DROP_TARGET_KEY); if (object instanceof DropTarget) { return (DropTarget) object; } return null; }
Example 7
Source File: ClipboardCopy.java From BiglyBT with GNU General Public License v2.0 | 5 votes |
public static void removeCopyToClipMenu( Control control ) { MouseAdapter ml = (MouseAdapter)control.getData( MOUSE_LISTENER_KEY ); if ( ml != null ){ control.removeMouseListener( ml ); } }
Example 8
Source File: BaseMDI.java From BiglyBT with GNU General Public License v2.0 | 5 votes |
public static BaseMdiEntry getEntryFromSkinObject(PluginUISWTSkinObject pluginSkinObject) { if (pluginSkinObject instanceof SWTSkinObject) { Control control = ((SWTSkinObject) pluginSkinObject).getControl(); while (control != null && !control.isDisposed()) { Object entry = control.getData("BaseMDIEntry"); if (entry instanceof BaseMdiEntry) { BaseMdiEntry mdiEntry = (BaseMdiEntry) entry; return mdiEntry; } control = control.getParent(); } } return null; }
Example 9
Source File: PromptSupport.java From nebula with Eclipse Public License 2.0 | 5 votes |
/** * <p> * Sets the prompt text on <code>control</code> * </p> * * @param promptText * @param textComponent * @exception IllegalArgumentException if the control is not a Text Box, a * Combo Box, a StyledText or a CCombo */ public static void setPrompt(final String promptText, final Control control) { checkControl(control); final boolean alreadySet = control.getData(SET) == null ? false : (Boolean) control.getData(SET); if (alreadySet) { throw new IllegalArgumentException("A prompt has already been set on this control !"); } control.setData(PROMPT, promptText); final BaseFocusControlListener focusControlListener = FocusControlListenerFactory.getFocusControlListenerFor(control); control.addFocusListener(focusControlListener); control.addControlListener(focusControlListener); control.setData(SET, true); }
Example 10
Source File: ExpressionButtonUtil.java From birt with Eclipse Public License 1.0 | 5 votes |
public static ExpressionButton getExpressionButton( Control control ) { Object button = control.getData( ExpressionButtonUtil.EXPR_BUTTON ); if ( button instanceof ExpressionButton ) { return ( (ExpressionButton) button ); } return null; }
Example 11
Source File: CTreeComboViewer.java From nebula with Eclipse Public License 2.0 | 5 votes |
/** * @see org.eclipse.jface.viewers.AbstractTreeViewer#internalInitializeTree(org.eclipse.swt.widgets.Control) */ protected void internalInitializeTree(Control widget) { if (contentProviderIsLazy) { if (widget instanceof CTreeCombo && widget.getData() != null) { virtualLazyUpdateChildCount(widget, 0); return; } } super.internalInitializeTree(tree); }
Example 12
Source File: AccordionControl.java From birt with Eclipse Public License 1.0 | 4 votes |
/** Returns the header object for the given header label */ private Object getHeader( Control label ) { return label.getData( KEY_HEADER ); }
Example 13
Source File: BrowserWrapperSWTFactory.java From BiglyBT with GNU General Public License v2.0 | 4 votes |
public static BrowserWrapper create( Composite composite, int style ) { try{ Map<String,Object> properties = new HashMap<>(); for ( BrowserProvider provider: providers ){ try{ BrowserWrapper browser = provider.create( composite, style, properties); if ( browser != null ){ return( browser ); } }catch( Throwable e ){ Debug.out( e ); } Utils.disposeComposite( composite, false ); } return( new BrowserWrapperSWT( composite, style )); }catch( SWTError error ){ Control[] children = composite.getChildren(); for (Control child : children) { if ( child.getData( BROWSER_KEY ) != null ){ try { child.dispose(); } catch (Throwable t) { } } } return( new BrowserWrapperFake( composite, style, error )); } }
Example 14
Source File: ClipboardCopy.java From BiglyBT with GNU General Public License v2.0 | 4 votes |
public static void addCopyToClipMenu( final Control control, final copyToClipProvider provider ) { MouseAdapter ml = (MouseAdapter)control.getData( MOUSE_LISTENER_KEY ); if ( ml != null ){ control.removeMouseListener( ml ); } ml = new MouseAdapter() { @Override public void mouseDown( MouseEvent e ) { if ( control.isDisposed()){ return; } final String text = provider.getText(); if ( control.getMenu() != null || text == null || text.length() == 0 ){ return; } if (!(e.button == 3 || (e.button == 1 && e.stateMask == SWT.CONTROL))){ return; } final Menu menu = new Menu(control.getShell(),SWT.POP_UP); MenuItem item = new MenuItem( menu,SWT.NONE ); item.setData( MENU_ITEM_KEY, "" ); String msg_text_id; if ( provider instanceof copyToClipProvider2 ){ msg_text_id = ((copyToClipProvider2)provider).getMenuResource(); }else{ msg_text_id = "label.copy.to.clipboard"; } item.setText( MessageText.getString( msg_text_id )); item.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected( SelectionEvent arg0) { new Clipboard(control.getDisplay()).setContents(new Object[] {text}, new Transfer[] {TextTransfer.getInstance()}); } }); control.setMenu( menu ); menu.addMenuListener( new MenuAdapter() { @Override public void menuHidden( MenuEvent arg0 ) { if ( control.getMenu() == menu ){ control.setMenu( null ); } } }); menu.setVisible( true ); } }; control.setData( MOUSE_LISTENER_KEY, ml ); control.addMouseListener( ml ); }
Example 15
Source File: AccordionControl.java From birt with Eclipse Public License 1.0 | 4 votes |
/** Returns the content area for the given header label */ private ScrolledComposite getContentArea( Control label ) { return (ScrolledComposite) label.getData( KEY_CONTENT ); }
Example 16
Source File: TaskSelectType.java From birt with Eclipse Public License 1.0 | 4 votes |
private String getSubtypeFromButton( Control button ) { return (String) button.getData( ); }
Example 17
Source File: PromptSupport.java From nebula with Eclipse Public License 2.0 | 2 votes |
/** * Get the prompt text of <code>control</code>. * * @param control * @return the prompt text */ public static String getPrompt(final Control control) { return (String) control.getData(PROMPT); }
Example 18
Source File: PromptSupport.java From nebula with Eclipse Public License 2.0 | 2 votes |
/** * Get the foreground color of the prompt text. If no color has been set, * the <code>GREY</code> color will be returned. * * @param color * @return the color of the prompt text or <code>GREY</code>if none is set */ public static Color getForeground(final Control control) { final Color temp = (Color) control.getData(FOREGROUND); return temp == null ? control.getForeground() : temp; }
Example 19
Source File: PromptSupport.java From nebula with Eclipse Public License 2.0 | 2 votes |
/** * Returns the font style of the prompt text, which is a OR mix of * SWT.ITALIC, SWT.NONE or SWT.BOLD * * @param control * @return font style of the prompt text */ public static int getFontStyle(final Control control) { final Integer temp = (Integer) control.getData(STYLE); return temp == null ? SWT.ITALIC : temp; }
Example 20
Source File: PromptSupport.java From nebula with Eclipse Public License 2.0 | 2 votes |
/** * Get the {@link FocusBehavior} of <code>control</code>. * * @param control * @return the {@link FocusBehavior} or {@link FocusBehavior#HIDE_PROMPT} if * none is set */ public static FocusBehavior getFocusBehavior(final Control control) { final FocusBehavior temp = (FocusBehavior) control.getData(BEHAVIOR); return temp == null ? FocusBehavior.HIDE_PROMPT : temp; }