"Glauco
Reis" <gsrt@xxxxxxxxxxxx> wrote
in message news:3EA2AB9E.CD9A9D25@xxxxxxxxxxxx...Hi
David,
Exactly as Randy told you, to make the same behaviour of
editor TABs you must use CTabFolder. TabFoder don't implement the color
gradient behaviour, wich is need for Windows "look&feel".
The internal class you is looking for is org.eclipse.ui.internal.EditorWorkbook.java.
The following code shows the same behaviour of Edit Tab.
import org.eclipse.swt.*;
import org.eclipse.swt.custom.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.graphics.*;
public class TestCTabFolder {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setLayout(new FillLayout());
CTabFolder folder = new CTabFolder(shell,
SWT.BORDER);
folder.setSelectionForeground(display.getSystemColor(SWT.COLOR_WHITE));
folder.setSelectionBackground(new
Color[]{display.getSystemColor(SWT.COLOR_DARK_BLUE),
display.getSystemColor(SWT.COLOR_BLUE),
display.getSystemColor(SWT.COLOR_DARK_GRAY),
display.getSystemColor(SWT.COLOR_GRAY)},
new int[] {25, 50, 100});
folder.update();
for (int i = 0; i < 3; i++) {
CTabItem item
= new CTabItem(folder, SWT.BORDER);
item.setText("Edit
text"+i);
if ((i %2) ==
0)
item.setImage( new Image(display, "imagem.gif") );
else
item.setImage( new Image(display, "gold.gif") );
Text text = new
Text(folder, SWT.BORDER | SWT.MULTI);
text.setText("Content
for Item "+i);
item.setControl(text);
}
folder.addCTabFolderListener(new CTabFolderAdapter()
{
public void
itemClosed(CTabFolderEvent event) { }
});
shell.setSize(400, 400);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
}
[]s
Glauco Reis
David Taylor wrote:
Thanks Randy. I was looking too deep into
the ui/internal source and
completely skipped over the custom widgets.
-Dave
"Randy Hudson" <none@xxxxxxxxxx> wrote in message
news:b7vcpa$hl0$1@xxxxxxxxxxxxx...
>
>
>