Java Code Examples for org.eclipse.swt.widgets.Control#setVisible()

The following examples show how to use org.eclipse.swt.widgets.Control#setVisible() . These examples are extracted from open source projects. 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
private void showSpecificControls(boolean show) {
      	if (fElements.size() != 1)
      		return;

      	Preference[] preferences= fElements.get(0).getSpecificPreferences();
   	if (preferences.length == 0)
   		return;

   	fRequiresRelayout= true;
   	for (int i= 0; i < preferences.length; i++) {
		Preference preference= preferences[i];
		Control control= preference.getControl();
		control.setVisible(show);
		((GridData)control.getLayoutData()).exclude= !show;
	}
}
 
Example 2
public static void setExcludeGridData( Control control, boolean exclude )
{
	Object obj = control.getLayoutData( );
	if ( obj == null )
		control.setLayoutData( new GridData( ) );
	else if ( !( obj instanceof GridData ) )
		return;
	GridData data = (GridData) control.getLayoutData( );
	if ( exclude )
	{
		data.heightHint = 0;
	}
	else
	{
		data.heightHint = -1;
	}
	control.setLayoutData( data );
	control.getParent( ).layout( );
	control.setVisible( !exclude );
}
 
Example 3
@Override
public void show ()
{
    logger.debug ( "Showing component" );

    for ( final Control control : this.controls )
    {
        control.setVisible ( true );
    }
}
 
Example 4
@Override
public void hide ()
{
    for ( final Control control : this.controls )
    {
        control.setVisible ( false );
    }
}
 
Example 5
private void setBasicMode() {
    fAdvancedMode = false;
    fRefTimeColumn.setData(WIDTH_KEY, fRefTimeColumn.getWidth());
    fTargetTimeColumn.setData(WIDTH_KEY, fTargetTimeColumn.getWidth());
    for (TreeItem treeItem : fViewer.getViewer().getTree().getItems()) {
        Control editor = (Control) treeItem.getData(EDITOR_KEY);
        editor.setVisible(false);
    }
    fTargetTimeColumn.setWidth(0);
    fTargetTimeColumn.setResizable(false);
    fRefTimeColumn.setWidth(0);
    fRefTimeColumn.setResizable(false);
    fButtonViewerColumn.getColumn().setWidth(0);
    fAdvancedMessageLabel.setText(""); //$NON-NLS-1$
}
 
Example 6
private void setAdvancedMode() {
    fAdvancedMode = true;
    fButtonViewerColumn.getColumn().setWidth(TREE_EDITOR_MIN_WIDTH);
    fRefTimeColumn.setWidth((Integer) fRefTimeColumn.getData(WIDTH_KEY));
    fRefTimeColumn.setResizable(true);
    fTargetTimeColumn.setWidth((Integer) fTargetTimeColumn.getData(WIDTH_KEY));
    fTargetTimeColumn.setResizable(true);
    for (TreeItem treeItem : fViewer.getViewer().getTree().getItems()) {
        Control editor = (Control) treeItem.getData(EDITOR_KEY);
        editor.setVisible(true);
    }
    fAdvancedMessageLabel.setText(Messages.OffsetDialog_AdvancedMessage);
}
 
Example 7
/**
 * Sets the visibility of a control. Includes setting of the include property of the layoutData (if available)
 * 
 * @param visible
 */
public static void setVisiblity(Control control, boolean visible)
{
	if (control == null)
	{
		return;
	}

	control.setVisible(visible);
	Object layoutData = control.getLayoutData();
	if (layoutData instanceof GridData)
	{
		((GridData) layoutData).exclude = !visible;
	}
}
 
Example 8
private void switchViewer(int state) {
	//Indicate which viewer is to be used
	if (fCurrViewState == state)
		return;
	else {
		fCurrViewState= state;
		IPreferenceStore store= JavaPlugin.getDefault().getPreferenceStore();
		store.setValue(getViewSite().getId() + TAG_VIEW_STATE, state);
	}

	//get the information from the existing viewer
	StructuredViewer viewer= fWrappedViewer.getViewer();
	Object object= viewer.getInput();
	ISelection selection= viewer.getSelection();

	// create and set up the new viewer
	Control control= createViewer(fWrappedViewer.getControl().getParent()).getControl();

	setUpViewer(fWrappedViewer);

	createSelectAllAction();

	// add the selection information from old viewer
	fWrappedViewer.setViewerInput(object);
	fWrappedViewer.getControl().setFocus();
	fWrappedViewer.setSelection(selection, true);

	// dispose old viewer
	viewer.getContentProvider().dispose();
	viewer.getControl().dispose();

	// layout the new viewer
	if (control != null && !control.isDisposed()) {
		control.setVisible(true);
		control.getParent().layout(true);
	}
}
 
Example 9
Source Project: birt   File: WidgetUtil.java    License: Eclipse Public License 1.0 5 votes vote down vote up
public static void setExcludeGridData( Control control, boolean exclude )
{
	Object obj = control.getLayoutData( );
	if ( obj == null )
		control.setLayoutData( new GridData( ) );
	else if ( !( obj instanceof GridData ) )
		return;
	GridData data = (GridData) control.getLayoutData( );
	data.exclude = exclude;
	control.setLayoutData( data );
	control.setVisible( !exclude );
}
 
Example 10
private void setVisible(Control control, boolean visible) {
    control.setVisible(visible);
    Object layoutData = control.getLayoutData();
    if (layoutData instanceof GridData) {
        ((GridData) layoutData).exclude = !visible;
    }
}
 
Example 11
Source Project: atdl4j   File: AbstractSWTWidget.java    License: MIT License 5 votes vote down vote up
public void setVisible(boolean visible)
{
	for ( Control control : getControls() )
	{
		control.setVisible( visible );
	}
}
 
Example 12
Source Project: atdl4j   File: SWTLabelWidget.java    License: MIT License 5 votes vote down vote up
public void setVisible(boolean visible)
{
	for ( Control control : getControls() )
	{
		control.setVisible( visible );
	}
}
 
Example 13
public static void setControlVisibility(Control control, boolean visible) {
	control.setVisible(visible);
	((GridData)control.getLayoutData()).exclude = !visible;
}
 
Example 14
private static void setControlVisible(Control control, boolean visible) {
    GridData gridData = (GridData) control.getLayoutData();
    gridData.exclude = !visible;
    control.setVisible(visible);
}
 
Example 15
@Override
protected Control createContents(Composite parent) {
	if (!fIsValidElement || fIsReadOnly) {
		Composite inner= new Composite(parent, SWT.NONE);
		
		if (fIsReadOnly) {
			GridLayout layout= new GridLayout();
			layout.marginWidth= 0;
			inner.setLayout(layout);

			Label label= new Label(inner, SWT.WRAP);
			label.setText(PreferencesMessages.JavadocConfigurationPropertyPage_location_path);
			
			Text location= new Text(inner, SWT.READ_ONLY | SWT.WRAP);
			SWTUtil.fixReadonlyTextBackground(location);
			GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL);
			gd.widthHint= convertWidthInCharsToPixels(80);
			location.setLayoutData(gd);
			String locationPath= PreferencesMessages.JavadocConfigurationPropertyPage_locationPath_none;
			if (fEntry != null) {
				URL javadocUrl= JavaDocLocations.getLibraryJavadocLocation(fEntry);
				if (javadocUrl != null) {
					locationPath= javadocUrl.toExternalForm();
				}
			}
			location.setText(locationPath);
			Dialog.applyDialogFont(inner);
		}
		return inner;
	}

	IJavaElement elem= getJavaElement();
	fInitalLocation= null;
	if (elem != null) {
		try {
			fInitalLocation= JavaUI.getJavadocBaseLocation(elem);
		} catch (JavaModelException e) {
			JavaPlugin.log(e);
		}
	}

	boolean isProject= (elem instanceof IJavaProject);
	fJavadocConfigurationBlock= new JavadocConfigurationBlock(getShell(), this, fInitalLocation, isProject);
	Control control= fJavadocConfigurationBlock.createContents(parent);
	control.setVisible(elem != null);

	Dialog.applyDialogFont(control);
	return control;
}
 
Example 16
private void setVisible(Control control, boolean visible) {
	control.setVisible(visible);
	((GridData)control.getLayoutData()).exclude= !visible;
}
 
Example 17
private void setVisible(Control control, boolean visible) {
    control.setVisible(visible);
    GridData layoutData = (GridData) control.getLayoutData();
    layoutData.exclude = !visible;
}
 
Example 18
public void hide(Control child) {
    child.setData(HIDDEN, true);
    child.setVisible(false);
}
 
Example 19
public void show(Control child) {
    child.setData(HIDDEN, false);
    child.setVisible(true);
}