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

The following examples show how to use org.eclipse.swt.widgets.Control#isVisible() . 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: SWTSkinObjectContainer.java    From BiglyBT with GNU General Public License v2.0 6 votes vote down vote up
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 2
Source File: PageForTaskIntegratorWizard.java    From CogniCrypt with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * This method will check whether all the validations on the page were successful. The page is set to incomplete if any of the validations have an ERROR.
 */
public void checkIfModeSelectionPageIsComplete() {
	boolean errorOnFileWidgets = false;
	// The first child of the composite is a group. Get the children of this group to iterated over.
	for (final Control control : ((Composite) getCompositeChoiceForModeOfWizard().getChildren()[0]).getChildren()) {
		// Check if the child is an instance of group and is visible.
		if (control instanceof Composite && control.isVisible()) {

			// Get the children of this group and iterate over them. These are the widgets that get the file data. This loop generalizes for all these widgets.
			for (final Control subGroup : ((Composite) control).getChildren()) {
				if (subGroup instanceof CompositeBrowseForFile) {
					final CompositeBrowseForFile tempVaraiable = (CompositeBrowseForFile) subGroup;
					if ((tempVaraiable).getDecFilePath().getDescriptionText().contains(Constants.ERROR)) {
						errorOnFileWidgets = true;
					}
				}

			}

		}
	}

	// Check if validation failed on the task name.
	final boolean errorOnTaskName = getCompositeChoiceForModeOfWizard().getDecNameOfTheTask().getDescriptionText().contains(Constants.ERROR);

	// Set the page to incomplete if the validation failed on any of the text boxes.
	if (errorOnTaskName || errorOnFileWidgets) {
		setPageComplete(false);

	} else {
		setPageComplete(true);
	}
}
 
Example 3
Source File: AbstractSWTWidget.java    From atdl4j with MIT License 5 votes vote down vote up
public boolean isVisible()
{
	for ( Control control : getControls() )
	{
		if ( control.isVisible() )
		{
			return true;
		}
	}
	
	return false;
}
 
Example 4
Source File: SWTLabelWidget.java    From atdl4j with MIT License 5 votes vote down vote up
public boolean isVisible()
{
	for ( Control control : getControls() )
	{
		if ( control.isVisible() )
		{
			return true;
		}
	}

	return false;
}
 
Example 5
Source File: ReminderView.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
public void runInUi(final ElexisEvent ev){
	if (((Patient) ev.getObject()).equals(actPatient)) {
		return;
	}
	actPatient = (Patient) ev.getObject();
	// clear selection before update
	cv.getViewerWidget().setSelection(StructuredSelection.EMPTY);
	
	Control control = cv.getViewerWidget().getControl();
	if (control != null && !control.isDisposed() && control.isVisible()) {
		cv.notify(CommonViewer.Message.update);
	}
	/**
	 * ch.elexis.core.data.events.PatientEventListener will be called on opposite
	 * Preferences.USR_SHOWPATCHGREMINDER condition.
	 */
	if (!CoreHub.userCfg.get(Preferences.USR_SHOWPATCHGREMINDER, true)) {
		UiDesk.asyncExec(new Runnable() {
			
			public void run(){
				List<Reminder> list = Reminder.findOpenRemindersResponsibleFor(
					CoreHub.getLoggedInContact(), false, (Patient) ev.getObject(), true);
				if (list.size() != 0) {
					StringBuilder sb = new StringBuilder();
					for (Reminder r : list) {
						sb.append(r.getSubject() + "\n");
						sb.append(r.getMessage() + "\n\n");
					}
					SWTHelper.alert(Messages.ReminderView_importantRemindersCaption,
						sb.toString());
				}
			}
		});
	}
}
 
Example 6
Source File: ReminderView.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
public void runInUi(ElexisEvent ev){
	refreshUserConfiguration();
	
	Control control = cv.getViewerWidget().getControl();
	if (control != null && !control.isDisposed() && control.isVisible()) {
		cv.notify(CommonViewer.Message.update);
	}
	
}
 
Example 7
Source File: TexlipseWizardPage.java    From texlipse with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Update the status to the status bar.
 * 
 * The statusbar message is an error message, if at least one of the
 * fields has an invalid value. If the current field has an invalid value,
 * the corresponding error message is displayed. Otherwise,
 * the first error message found (starting from the top) is displayed.
 * 
 * @param lastStatus
 * @param number  
 */
protected void updateStatus(IStatus lastStatus, Object key) {
    
    IStatus status = null;
    boolean allOk = true;
    
    // update the status cache
    statusMap.put(key, lastStatus);
    
    // see if we got an error
    if (lastStatus.matches(IStatus.ERROR)) {
        status = lastStatus;
        allOk = false;
    } else {
    
        // see if some other value is invalid
        Iterator<IStatus> iter = statusMap.values().iterator();
        while (iter.hasNext()) {
            IStatus i = iter.next();
            if (!i.matches(IStatus.OK)) status = i;
            if (i.matches(IStatus.ERROR)) {
                allOk = false;
                break;
            }
        }
    }
    
    // enable/disable next-button
    setPageComplete(allOk);
    
    // only set status if this page is visible
    Control ctrl = getControl();
    if (ctrl != null && ctrl.isVisible()) {
        
        if (status == null) {
            status = lastStatus;
        }
        
        applyToStatusLine(this, status);
    }
}
 
Example 8
Source File: TypeHierarchyViewPart.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public void setViewLayout(int layout) {
	if (fCurrentLayout != layout || layout == VIEW_LAYOUT_AUTOMATIC) {
		fInComputeLayout= true;
		try {
			boolean methodViewerNeedsUpdate= false;

			if (fMethodViewerViewForm != null && !fMethodViewerViewForm.isDisposed()
					&& fTypeMethodsSplitter != null && !fTypeMethodsSplitter.isDisposed()) {

				boolean horizontal= false;
				if (layout == VIEW_LAYOUT_SINGLE) {
					fMethodViewerViewForm.setVisible(false);
					showMembersInHierarchy(false);
					updateMethodViewer(null);
				} else {
					if (fCurrentLayout == VIEW_LAYOUT_SINGLE) {
						fMethodViewerViewForm.setVisible(true);
						methodViewerNeedsUpdate= true;
					}
					if (layout == VIEW_LAYOUT_AUTOMATIC) {
						if (fParent != null && !fParent.isDisposed()) {
							Point size= fParent.getSize();
							if (size.x != 0 && size.y != 0) {
								// bug 185397 - Hierarchy View flips orientation multiple times on resize
								Control viewFormToolbar= fTypeViewerViewForm.getTopLeft();
								if (viewFormToolbar != null && !viewFormToolbar.isDisposed() && viewFormToolbar.isVisible()) {
									size.y -= viewFormToolbar.getSize().y;
								}
								horizontal= size.x > size.y;
							} else if (size.x == 0 && size.y == 0) {
								return;
							}
						}
						if (fCurrentLayout == VIEW_LAYOUT_AUTOMATIC) {
							boolean wasHorizontal= fTypeMethodsSplitter.getOrientation() == SWT.HORIZONTAL;
							if (wasHorizontal == horizontal) {
								return; // no real change
							}
						}

					} else if (layout == VIEW_LAYOUT_HORIZONTAL) {
						horizontal= true;
					}
					fTypeMethodsSplitter.setOrientation(horizontal ? SWT.HORIZONTAL : SWT.VERTICAL);
				}
				updateMainToolbar(horizontal);
				fTypeMethodsSplitter.layout();
			}
			if (methodViewerNeedsUpdate) {
				updateMethodViewer(fSelectedType);
			}
			fDialogSettings.put(DIALOGSTORE_VIEWLAYOUT, layout);
			fCurrentLayout= layout;

			updateCheckedState();
		} finally {
			fInComputeLayout= false;
		}
	}
}
 
Example 9
Source File: WidgetHelper.java    From swt-bling with MIT License 4 votes vote down vote up
public static boolean isControlSafeAndVisible(Control control) {
  return isWidgetSafe(control) && control.isVisible();
}
 
Example 10
Source File: ElexisUiEventListenerImpl.java    From elexis-3-core with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Test if the control is not disposed and visible.
 * 
 * @param control
 * @return
 */
protected boolean isActiveControl(Control control) {
	return control != null && !control.isDisposed() && control.isVisible();
}
 
Example 11
Source File: CoreUiUtil.java    From elexis-3-core with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Test if the control is not disposed and visible.
 * 
 * @param control
 * @return
 */
public static boolean isActiveControl(Control control){
	return control != null && !control.isDisposed() && control.isVisible();
}
 
Example 12
Source File: CoreUiUtil.java    From elexis-3-core with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Test if the control is not disposed and visible.
 * 
 * @param control
 * @return
 */
public static boolean isActiveControl(Control control){
	return control != null && !control.isDisposed() && control.isVisible();
}