org.eclipse.jface.dialogs.DialogPage Java Examples

The following examples show how to use org.eclipse.jface.dialogs.DialogPage. 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: SolidityCompilerPreferencePage.java    From solidity-ide with Eclipse Public License 1.0 6 votes vote down vote up
private void validateFile() {
	String pathToSolc = compilerPathFieldEditor.getStringValue();
	if (pathToSolc == null || pathToSolc.isEmpty()) {
		return;
	}
	File file = new File(pathToSolc);
	if (file.exists() && file.isFile() && file.canExecute()
			&& (file.getName().contains("solc") || file.getName().contains("solcjs"))) {
		if (file.getName().contains("solcjs")) {
			setMessage("Use of 'solcjs' is discuraged!", DialogPage.WARNING);
		}
	} else {
		setValid(false);
		setErrorMessage("Path must point to 'solc' or 'solcjs' executable");
	}
}
 
Example #2
Source File: TexlipseWizardPage.java    From texlipse with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Add a status bar message.
 * 
 * @param page
 * @param status
 */
protected static void applyToStatusLine(DialogPage page, IStatus status) {

    String errorMessage = null;
    String warningMessage = null;
    String statusMessage = status.getMessage();
    
    if (statusMessage.length() > 0) {
        if (status.matches(IStatus.ERROR)) {
            errorMessage = statusMessage;
        } else if (!status.isOK()) {
            warningMessage = statusMessage;
        }
    }
    page.setErrorMessage(errorMessage);
    page.setMessage(warningMessage, status.getSeverity());
}
 
Example #3
Source File: PropertyAndPreferencePage.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
private static void applyToStatusLine(DialogPage page, IStatus status) {
	String message = status.getMessage();
	if (message != null && message.length() == 0) {
		message = null;
	}
	switch (status.getSeverity()) {
		case IStatus.OK:
			page.setMessage(message, IMessageProvider.NONE);
			page.setErrorMessage(null);
			break;
		case IStatus.WARNING:
			page.setMessage(message, IMessageProvider.WARNING);
			page.setErrorMessage(null);
			break;
		case IStatus.INFO:
			page.setMessage(message, IMessageProvider.INFORMATION);
			page.setErrorMessage(null);
			break;
		default:
			page.setMessage(null);
			page.setErrorMessage(message);
			break;
	}
}
 
Example #4
Source File: StatusUtil.java    From typescript.java with MIT License 6 votes vote down vote up
/**
 * Applies the status to the status line of a dialog page.
 */
public static void applyToStatusLine(DialogPage page, IStatus status) {
	String message= Status.OK_STATUS.equals(status) ? null : status.getMessage();
	switch (status.getSeverity()) {
		case IStatus.OK:
			page.setMessage(message, IMessageProvider.NONE);
			page.setErrorMessage(null);
			break;
		case IStatus.WARNING:
			page.setMessage(message, IMessageProvider.WARNING);
			page.setErrorMessage(null);
			break;
		case IStatus.INFO:
			page.setMessage(message, IMessageProvider.INFORMATION);
			page.setErrorMessage(null);
			break;
		default:
			if (message.length() == 0) {
				message= null;
			}
			page.setMessage(null);
			page.setErrorMessage(message);
			break;
	}
}
 
Example #5
Source File: StatusUtil.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Applies the status to the status line of a dialog page.
 * @param page the dialog page
 * @param status the status to apply
 */
public static void applyToStatusLine(DialogPage page, IStatus status) {
	String message= status.getMessage();
	if (message != null && message.length() == 0) {
		message= null;
	}
	switch (status.getSeverity()) {
		case IStatus.OK:
			page.setMessage(message, IMessageProvider.NONE);
			page.setErrorMessage(null);
			break;
		case IStatus.WARNING:
			page.setMessage(message, IMessageProvider.WARNING);
			page.setErrorMessage(null);
			break;
		case IStatus.INFO:
			page.setMessage(message, IMessageProvider.INFORMATION);
			page.setErrorMessage(null);
			break;
		default:
			page.setMessage(null);
			page.setErrorMessage(message);
			break;
	}
}
 
Example #6
Source File: StatusUtil.java    From editorconfig-eclipse with Apache License 2.0 6 votes vote down vote up
/**
 * Applies the status to the status line of a dialog page.
 */
public static void applyToStatusLine(DialogPage page, IStatus status) {
	String message= status.getMessage();
	switch (status.getSeverity()) {
		case IStatus.OK:
			page.setMessage(message, IMessageProvider.NONE);
			page.setErrorMessage(null);
			break;
		case IStatus.WARNING:
			page.setMessage(message, IMessageProvider.WARNING);
			page.setErrorMessage(null);
			break;				
		case IStatus.INFO:
			page.setMessage(message, IMessageProvider.INFORMATION);
			page.setErrorMessage(null);
			break;			
		default:
			if (message.length() == 0) {
				message= null;
			}
			page.setMessage(null);
			page.setErrorMessage(message);
			break;		
	}
}
 
Example #7
Source File: MavenCoordinatesWizardUi.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
/**
 * Convenience method to set a validation message on {@link DialogPage} from the result of calling
 * {@link #validateMavenSettings()}.
 *
 * @return {@code true} if no validation message was set; {@code false} otherwise
 *
 * @see #validateMavenSettings()
 */
public boolean setValidationMessage(DialogPage page) {
  IStatus status = validateMavenSettings();
  if (status.isOK()) {
    return true;
  }

  if (IStatus.ERROR == status.getSeverity()) {
    page.setErrorMessage(status.getMessage());
  } else if (IStatus.WARNING == status.getSeverity()) {
    page.setMessage(status.getMessage(), IMessageProvider.WARNING);
  } else if (IStatus.INFO == status.getSeverity()) {
    page.setMessage(status.getMessage(), IMessageProvider.INFORMATION);
  }
  return false;
}
 
Example #8
Source File: SelectLanguageConfigurationWizardPage.java    From tm4e with Eclipse Public License 1.0 6 votes vote down vote up
private static void applyToStatusLine(DialogPage page, IStatus status) {
	String message = Status.OK_STATUS.equals(status) ? null : status.getMessage();
	switch (status.getSeverity()) {
	case IStatus.OK:
		page.setMessage(message, IMessageProvider.NONE);
		page.setErrorMessage(null);
		break;
	case IStatus.WARNING:
		page.setMessage(message, IMessageProvider.WARNING);
		page.setErrorMessage(null);
		break;
	case IStatus.INFO:
		page.setMessage(message, IMessageProvider.INFORMATION);
		page.setErrorMessage(null);
		break;
	default:
		if (message != null && message.length() == 0) {
			message = null;
		}
		page.setMessage(null);
		page.setErrorMessage(message);
		break;
	}
}
 
Example #9
Source File: AbstractWizardPage.java    From tm4e with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Applies the status to the status line of a dialog page.
 */
private static void applyToStatusLine(DialogPage page, IStatus status) {
	String message = Status.OK_STATUS.equals(status) ? null : status.getMessage();
	switch (status.getSeverity()) {
	case IStatus.OK:
		page.setMessage(message, IMessageProvider.NONE);
		page.setErrorMessage(null);
		break;
	case IStatus.WARNING:
		page.setMessage(message, IMessageProvider.WARNING);
		page.setErrorMessage(null);
		break;
	case IStatus.INFO:
		page.setMessage(message, IMessageProvider.INFORMATION);
		page.setErrorMessage(null);
		break;
	default:
		if (message != null && message.length() == 0) {
			message = null;
		}
		page.setMessage(null);
		page.setErrorMessage(message);
		break;
	}
}
 
Example #10
Source File: QueryStringWizardPage.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
private void update ()
{
    final String filterType = this.filterTypeEntry.getText ();
    final String filterData = this.filterEntry.getText ();

    boolean warning = false;

    if ( "".equals ( filterType ) )
    {
        setPageComplete ( false );
        setMessage ( "Select a filter type", DialogPage.ERROR );
        return;
    }
    if ( "".equals ( filterData ) )
    {
        setMessage ( "Empty filter string might be a problem", DialogPage.WARNING );
        warning = true;
    }

    if ( !warning )
    {
        setMessage ( null );
    }
    setPageComplete ( true );
}
 
Example #11
Source File: AbstractN4JSPreferencePage.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
/** copied from PropertyAndPreferencePage */
private static void applyToStatusLine(DialogPage page, IStatus status) {
	String message = status.getMessage();
	if (message != null && message.length() == 0) {
		message = null;
	}
	switch (status.getSeverity()) {
	case IStatus.OK:
		page.setMessage(message, IMessageProvider.NONE);
		page.setErrorMessage(null);
		break;
	case IStatus.WARNING:
		page.setMessage(message, IMessageProvider.WARNING);
		page.setErrorMessage(null);
		break;
	case IStatus.INFO:
		page.setMessage(message, IMessageProvider.INFORMATION);
		page.setErrorMessage(null);
		break;
	default:
		page.setMessage(null);
		page.setErrorMessage(message);
		break;
	}
}
 
Example #12
Source File: AbstractPydevPrefs.java    From Pydev with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Applies the status to the status line of a dialog page.
 *
 * @param page the dialog page
 * @param status the status
 */
public void applyToStatusLine(DialogPage page, IStatus status) {
    String message = status.getMessage();
    switch (status.getSeverity()) {
        case IStatus.OK:
            page.setMessage(message, IMessageProvider.NONE);
            page.setErrorMessage(null);
            break;
        case IStatus.WARNING:
            page.setMessage(message, IMessageProvider.WARNING);
            page.setErrorMessage(null);
            break;
        case IStatus.INFO:
            page.setMessage(message, IMessageProvider.INFORMATION);
            page.setErrorMessage(null);
            break;
        default:
            if (message.length() == 0) {
                message = null;
            }
            page.setMessage(null);
            page.setErrorMessage(message);
            break;
    }
}
 
Example #13
Source File: StatusUtil.java    From Pydev with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Applies the status to the status line of a dialog page.
 * @param page the dialog page
 * @param status the status to apply
 */
public static void applyToStatusLine(DialogPage page, IStatus status) {
    String message = status.getMessage();
    if (message != null && message.length() == 0) {
        message = null;
    }
    switch (status.getSeverity()) {
        case IStatus.OK:
            page.setMessage(message, IMessageProvider.NONE);
            page.setErrorMessage(null);
            break;
        case IStatus.WARNING:
            page.setMessage(message, IMessageProvider.WARNING);
            page.setErrorMessage(null);
            break;
        case IStatus.INFO:
            page.setMessage(message, IMessageProvider.INFORMATION);
            page.setErrorMessage(null);
            break;
        default:
            page.setMessage(null);
            page.setErrorMessage(message);
            break;
    }
}
 
Example #14
Source File: DartLog.java    From dartboard with Eclipse Public License 2.0 6 votes vote down vote up
public static void applyToStatusLine(DialogPage page, IStatus status) {
	String message = status.getMessage();
	switch (status.getSeverity()) {
	case IStatus.OK:
		page.setMessage(message, IMessageProvider.NONE);
		page.setErrorMessage(null);
		break;
	case IStatus.WARNING:
		page.setMessage(message, IMessageProvider.WARNING);
		page.setErrorMessage(null);
		break;
	case IStatus.INFO:
		page.setMessage(message, IMessageProvider.INFORMATION);
		page.setErrorMessage(null);
		break;
	default:
		if (message.isEmpty()) {
			message = null;
		}
		page.setMessage(null);
		page.setErrorMessage(message);
		break;
	}
}
 
Example #15
Source File: AbapGitWizardPageApack.java    From ADT_Frontend with MIT License 5 votes vote down vote up
private boolean validatePackageNotEmpty(IApackDependency apackDependency) {
	if (apackDependency.getTargetPackage() == null || apackDependency.getTargetPackage().getName() == null
			|| apackDependency.getTargetPackage().getName().isEmpty()) {
		setMessage(NLS.bind(Messages.AbapGitWizardPageApack_task_invalid_package_assignment,
				apackDependency.getGroupId() + "-" + apackDependency.getArtifactId()), DialogPage.ERROR); //$NON-NLS-1$
		setPageComplete(false);
		return false;
	}
	return true;
}
 
Example #16
Source File: AbapGitWizardPageApack.java    From ADT_Frontend with MIT License 5 votes vote down vote up
private boolean validatePackagesUnique(List<IApackDependency> apackDependencies) {
	List<String> usedPackages = new ArrayList<String>();
	usedPackages.add(this.cloneData.packageRef.getName());
	for (IApackDependency apackDependency : apackDependencies) {
		String newPackageName = apackDependency.getTargetPackage().getName();
		if (usedPackages.contains(newPackageName)) {
			setMessage(NLS.bind(Messages.AbapGitWizardPageApack_task_package_used_multiple_times, newPackageName), DialogPage.ERROR);
			setPageComplete(false);
			return false;
		} else {
			usedPackages.add(newPackageName);
		}
	}
	return true;
}
 
Example #17
Source File: AbapGitWizardPageApack.java    From ADT_Frontend with MIT License 5 votes vote down vote up
private boolean validatePackageTransportLayer(IAdtTransportCheckData[] dependencyCheckData) {
	IAdtTransportCheckData referenceCheckData = dependencyCheckData[0];
	for (int i = 1; i < dependencyCheckData.length; i++) {
		if (!referenceCheckData.getPackageSoftwareComponent().equals(dependencyCheckData[i].getPackageSoftwareComponent())
				|| !referenceCheckData.getPackageTransportLayer().equals(dependencyCheckData[i].getPackageTransportLayer())) {
			setMessage(NLS.bind(Messages.AbapGitWizardPageApack_task_transport_layers_differ, referenceCheckData.getObjectName(),
					dependencyCheckData[i].getObjectName()), DialogPage.ERROR);
			setPageComplete(false);
			return false;
		}
	}
	return true;
}
 
Example #18
Source File: ProjectSdkPanel.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
/**
	 * Create a new instance of a project SDK composite.
	 * @param dialogPage that hosts the parent composite
	 * @param parent the parent composite to add this one to
	 * @param hspans[3] - hspans for label, combobox and button
	 */
	public ProjectSdkPanel (DialogPage dialogPage, Composite parent, int hspans[]) {
	    Assert.isTrue(hspans.length == 3, "ProjectSdkPanel() - wrong hspans[] array"); //$NON-NLS-1$
		Composite container = parent;
//		if (hspan < 3) {
//			container = SWTFactory.createComposite(parent, parent.getFont(), 3, hspan, GridData.FILL_HORIZONTAL);
//			hspan = 3;
//		}
		
		createControl(dialogPage, container, hspans);
	}
 
Example #19
Source File: AbapGitWizardPageApack.java    From ADT_Frontend with MIT License 5 votes vote down vote up
private boolean validateCheckData(List<IApackDependency> apackDependencies, IAdtTransportCheckData[] dependencyCheckData) {
	if ((dependencyCheckData.length - 1) != apackDependencies.size()) {
		setMessage(Messages.AbapGitWizardPageApack_task_error_retrieving_transport_data, DialogPage.ERROR);
		setPageComplete(false);
		return false;
	}
	return true;
}
 
Example #20
Source File: StatusUtil.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Applies the status to the status line of a dialog page.
 */
public static void applyToStatusLine(DialogPage page, IStatus status)
{
	String message = status.getMessage();
	switch (status.getSeverity())
	{
		case IStatus.OK:
			page.setMessage(message, IMessageProvider.NONE);
			page.setErrorMessage(null);
			break;
		case IStatus.WARNING:
			page.setMessage(message, IMessageProvider.WARNING);
			page.setErrorMessage(null);
			break;
		case IStatus.INFO:
			page.setMessage(message, IMessageProvider.INFORMATION);
			page.setErrorMessage(null);
			break;
		default:
			if (message.length() == 0)
			{
				message = null;
			}
			page.setMessage(null);
			page.setErrorMessage(message);
			break;
	}
}
 
Example #21
Source File: DialogPageMessageTargetTest.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
@Test
public void clear() {
  target.setError("error_msg");
  target.clear();
  assertNull(page.getMessage());
  assertEquals(DialogPage.NONE, page.getMessageType());
}
 
Example #22
Source File: N4JSNewClassifierWizard.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Sets the error message for the active wizard page.
 *
 * Note that this method has no effect if the current page doesn't support error messages.
 */
private void setErrorMessage(String message) {
	IWizardContainer container = getContainer();
	if (container != null) {
		IWizardPage currentPage = container.getCurrentPage();
		if (currentPage instanceof DialogPage) {
			((DialogPage) currentPage).setErrorMessage(message);
		}
	}
}
 
Example #23
Source File: DialogPageMessageTargetTest.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() {
  page = new DialogPage() {
    @Override
    public void createControl(Composite parent) {
      throw new UnsupportedOperationException();
    }
  };
  target = new DialogPageMessageTarget(page);
}
 
Example #24
Source File: DialogPageUtils.java    From goclipse with Eclipse Public License 1.0 5 votes vote down vote up
public static void applyStatusToPage(DialogPage page, IStatus status) {
	String message = StringUtil.emptyAsNull(status.getMessage());
	
	if(status.getSeverity() == IStatus.ERROR) {
		page.setErrorMessage(message);
		page.setMessage(null);
	} else {
		page.setErrorMessage(null);
		page.setMessage(message, severityToMessageType(status));
	}
}
 
Example #25
Source File: StatusUtil.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Applies the status to the status line of a dialog page.
 * 
 * @param page
 *            the dialog page
 * @param status
 *            the status to apply
 */
public static void applyToStatusLine( DialogPage page, IStatus status )
{
	if ( status == null )
	{
		page.setMessage( null, IMessageProvider.NONE );
		page.setErrorMessage( null );
		return;
	}

	String message = status.getMessage( );

	if ( message != null && message.length( ) == 0 )
	{
		message = null;
	}

	switch ( status.getSeverity( ) )
	{
		case IStatus.OK :
			page.setMessage( message, IMessageProvider.NONE );
			page.setErrorMessage( null );
			break;
		case IStatus.WARNING :
			page.setMessage( message, IMessageProvider.WARNING );
			page.setErrorMessage( null );
			break;
		case IStatus.INFO :
			page.setMessage( message, IMessageProvider.INFORMATION );
			page.setErrorMessage( null );
			break;
		default :
			page.setMessage( null );
			page.setErrorMessage( message );
			break;
	}
}
 
Example #26
Source File: AbapGitWizardPageBranchAndPackage.java    From ADT_Frontend with MIT License 5 votes vote down vote up
private boolean validateClientOnly() {
	setMessage(null);

	if (this.comboBranches.getCombo().getText().isEmpty()) {
		setMessage(Messages.AbapGitWizardPageBranchAndPackage_combobox_branch_message, DialogPage.INFORMATION);
		return false;
	}

	if (this.txtPackage.getTextWidget().getText().isEmpty()) {
		setMessage(Messages.AbapGitWizardPageBranchAndPackage_text_package_message, DialogPage.INFORMATION);
		return false;
	}
	return true;
}
 
Example #27
Source File: NewSpecWizardPage.java    From tlaplus with MIT License 4 votes vote down vote up
/**
 * Reports a warning to the user
 * 
 * @param message
 */
private void reportWarning(String message)
{
    this.setPageComplete(true);
    this.setMessage(message, DialogPage.WARNING);
}
 
Example #28
Source File: NewSpecWizardPage.java    From tlaplus with MIT License 4 votes vote down vote up
/**
 * Reports an error to the user
 * 
 * @param message
 */
private void reportError(String message)
{
    this.setPageComplete(false);
    this.setMessage(message, DialogPage.ERROR);
}
 
Example #29
Source File: DatabaseWizardPage.java    From olca-app with Mozilla Public License 2.0 4 votes vote down vote up
private void error(String string) {
	setMessage(string, DialogPage.ERROR);
	setPageComplete(false);
}
 
Example #30
Source File: DialogPageMessageTarget.java    From google-cloud-eclipse with Apache License 2.0 4 votes vote down vote up
@Override
public void setError(String message) {
  target.setMessage(message, DialogPage.ERROR);
}