Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » Preference page resizes instead of label to wrap the text
Preference page resizes instead of label to wrap the text [message #52405] Sat, 28 March 2009 14:07
kishkin is currently offline kishkinFriend
Messages: 4
Registered: July 2009
Junior Member
Hey everyone!

Hope you can help me with this. PreferencePage object was created using
the tamplete. I added a few strings to createContents method (just
created a label actually). So, I cannot figure out how to prevent
preference page to resize and make label to fit the original page width
and then wrap the text.

I was able to get it done by using GridLayout and GridData, setting
widthHint to 416. But this is not fitting :).

Thanks in advance!

Just in case here's the code:

package pref;

import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.jface.resource.ImageDescriptor;
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;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;

public class WorkbenchPreferencePage1 extends PreferencePage implements
IWorkbenchPreferencePage {

public WorkbenchPreferencePage1() {
// TODO Auto-generated constructor stub
}

public WorkbenchPreferencePage1(String title) {
super(title);
// TODO Auto-generated constructor stub
}

public WorkbenchPreferencePage1(String title, ImageDescriptor image) {
super(title, image);
// TODO Auto-generated constructor stub
}

@Override
protected Control createContents(Composite parent) {
String string =
"Very very very very very very very very very very very very very
very very very very very very very very very very very very very very
very very long string.";

Composite composite = new Composite(parent, SWT.NONE);
composite.setLayout(new FillLayout());

Label label = new Label(composite, SWT.WRAP);
label.setText(string);

return null;
}

@Override
public void init(IWorkbench workbench) {
// TODO Auto-generated method stub

}

}
Previous Topic:3.5M6 Declarative Services
Next Topic:Preference page resizes instead of label to wrap the text
Goto Forum:
  


Current Time: Wed Jun 23 16:00:46 GMT 2021

Powered by FUDForum. Page generated in 0.02101 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top