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

The following examples show how to use org.eclipse.swt.widgets.Control#setVisible() . 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: LevelPropertyDialog.java    From birt with Eclipse Public License 1.0 6 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( );
	if ( exclude )
	{
		data.heightHint = 0;
	}
	else
	{
		data.heightHint = -1;
	}
	control.setLayoutData( data );
	control.getParent( ).layout( );
	control.setVisible( !exclude );
}
 
Example 2
Source File: LineWrappingTabPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
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 3
Source File: TrackingVisibleComponent.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void show ()
{
    logger.debug ( "Showing component" );

    for ( final Control control : this.controls )
    {
        control.setVisible ( true );
    }
}
 
Example 4
Source File: SWTLabelWidget.java    From atdl4j with MIT License 5 votes vote down vote up
public void setVisible(boolean visible)
{
	for ( Control control : getControls() )
	{
		control.setVisible( visible );
	}
}
 
Example 5
Source File: AbstractSWTWidget.java    From atdl4j with MIT License 5 votes vote down vote up
public void setVisible(boolean visible)
{
	for ( Control control : getControls() )
	{
		control.setVisible( visible );
	}
}
 
Example 6
Source File: FileFieldEditorCustom.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
private void setVisible(Control control, boolean visible) {
    control.setVisible(visible);
    Object layoutData = control.getLayoutData();
    if (layoutData instanceof GridData) {
        ((GridData) layoutData).exclude = !visible;
    }
}
 
Example 7
Source File: WidgetUtil.java    From birt with 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 8
Source File: PackagesView.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
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 File: SWTUtils.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 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 10
Source File: OffsetDialog.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
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 11
Source File: OffsetDialog.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
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 12
Source File: TrackingVisibleComponent.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void hide ()
{
    for ( final Control control : this.controls )
    {
        control.setVisible ( false );
    }
}
 
Example 13
Source File: JavadocConfigurationPropertyPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
@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 14
Source File: OptionsConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
private void setVisible(Control control, boolean visible) {
	control.setVisible(visible);
	((GridData)control.getLayoutData()).exclude= !visible;
}
 
Example 15
Source File: TimeGraphViewer.java    From tracecompass with Eclipse Public License 2.0 4 votes vote down vote up
private static void setControlVisible(Control control, boolean visible) {
    GridData gridData = (GridData) control.getLayoutData();
    gridData.exclude = !visible;
    control.setVisible(visible);
}
 
Example 16
Source File: PyCodeFormatterPage.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
private void setVisible(Control control, boolean visible) {
    control.setVisible(visible);
    GridData layoutData = (GridData) control.getLayoutData();
    layoutData.exclude = !visible;
}
 
Example 17
Source File: MagicComposite.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
public void hide(Control child) {
    child.setData(HIDDEN, true);
    child.setVisible(false);
}
 
Example 18
Source File: MagicComposite.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
public void show(Control child) {
    child.setData(HIDDEN, false);
    child.setVisible(true);
}
 
Example 19
Source File: IDEUtil.java    From codewind-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public static void setControlVisibility(Control control, boolean visible) {
	control.setVisible(visible);
	((GridData)control.getLayoutData()).exclude = !visible;
}