Public static void showecliplsetab (final shell)
{
Image image = new image (shell. getdisplay (), "d :\\ Program Files \ eclipsercp \ plugins \ org. Eclipse. Platform. source_4.2.1.v201209141800 \ eclipse32.png ");
Shell. settext ("copying the eclipse editing area tab ");
// Create a custom tab object
Final ctabfolder folder = new ctabfolder (shell, SWT. Border );
// Set the layout of the tab to maximize and minimize the appearance of the tab.
Folder. setlayoutdata (New griddata (SWT. Fill, SWT. Fill, true, false ));
// Set complex tabs, that is, Tab labels with rounded corners
Folder. setsimple (false );
// Set the status of unselected labels, icons, and "close" buttons
Folder. setunselectedimagevisible (true );
// Set the foreground color and background color
Folder. setselectionforeground (shell. getdisplay (). getsystemcolor (SWT. color_white ));
Folder. setselectionbackground (shell. getdisplay (). getsystemcolor (SWT. color_blue ));
// Display the "maximize" and "minimize" buttons
Folder. setmaximized (true );
Folder. setmaximizevisible (true );
Folder. setminimized (true );
Folder. setminimizevisible (true );
// Create a tab label object
For (INT I = 1; I <5; I ++)
{
Ctabitem item = new ctabitem (folder, SWT. Close );
Item. settext ("tab" + I );
Item. setimage (image );
// Place a text box in each tab
Text text = new text (folder, SWT. multi | SWT. v_scroll | SWT. h_scroll );
// The text in the text box is represented by \ n. When displayed, it is changed to the next line.
Text. settext ("this is the" + I + "Page: \ n this tab is modeled on the eclipse design \ n can be used to maximize and minimize ");
Item. setcontrol (text );
}
// Register a tab event
Folder. addctabfolder2listener (New ctabfolder2adapter (){
// Events triggered when the "minimize" button is clicked
Public void minimize (ctabfolderevent event ){
// Set the status of the tab to be minimized. The status of the tab determines the window button displayed in the upper right corner,
Folder. setminimized (true );
// Change the layout of the tab to display the minimized state.
Folder. setlayoutdata (New griddata (SWT. Fill, SWT. Fill, true, false ));
// Refresh the layout. Otherwise, the reset layout does not work.
Shell. layout (true );
}
// Events triggered when the unit clicks the "maximize" button
Public void maximize (ctabfolderevent event ){
Folder. setmaximized (true );
Folder. setlayoutdata (New griddata (SWT. Fill, SWT. Fill, true, true ));
Shell. layout (true );
}
// Events triggered when you click "Restore"
Public void restore (ctabfolderevent event)
{
Folder. setminimized (false );
Folder. setmaximized (false );
Folder. setlayoutdata (New griddata (SWT. Fill, SWT. Fill, true, false ));
Shell. layout (true );
}
});
}