
org.eclipse.ui.part.MessagePage Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of org.eclipse.ui.workbench Show documentation
Show all versions of org.eclipse.ui.workbench Show documentation
This is org.eclipse.ui.workbench jar used by Scout SDK
/*******************************************************************************
* Copyright (c) 2000, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.ui.part;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
/**
* A message page display a message in a pagebook view.
*
* This class may be instantiated; it is not intended to be subclassed.
*
*
* @see PageBookView
* @noextend This class is not intended to be subclassed by clients.
*/
public class MessagePage extends Page {
private Composite pgComp;
private Label msgLabel;
private String message = "";//$NON-NLS-1$
/**
* Creates a new page. The message is the empty string.
*/
public MessagePage() {
// do nothing
}
@Override
public void createControl(Composite parent) {
// Message in default page of Outline should have margins
pgComp = new Composite(parent, SWT.NULL);
pgComp.setLayout(new FillLayout());
msgLabel = new Label(pgComp, SWT.LEFT | SWT.TOP | SWT.WRAP);
msgLabel.setText(message);
}
@Override
public Control getControl() {
return pgComp;
}
/**
* Sets focus to a part in the page.
*/
@Override
public void setFocus() {
// important to give focus to the composite rather than the label
// as the composite will actually take focus (though hidden),
// but setFocus on a Label is a no-op
pgComp.setFocus();
}
/**
* Sets the message to the given string.
*
* @param message the message text
*/
public void setMessage(String message) {
this.message = message;
if (msgLabel != null) {
msgLabel.setText(message);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy