use of org.eclipse.swt.custom.CTabFolderEvent in project jbosstools-hibernate by jbosstools.
the class QueryPageTabView method createPartControl.
public void createPartControl(Composite parent) {
tabs = new CTabFolder(parent, SWT.CLOSE | SWT.BOTTOM);
tabs.setSimple(false);
tabs.setUnselectedCloseVisible(false);
tabs.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
fireSelectionChangedEvent();
}
});
tabs.addCTabFolder2Listener(new CTabFolder2Adapter() {
public void close(CTabFolderEvent event) {
QueryPage qp = (QueryPage) event.item.getData();
KnownConfigurations.getInstance().getQueryPageModel().remove(qp);
}
});
rebuild();
initActions();
provideSelection();
}
use of org.eclipse.swt.custom.CTabFolderEvent in project rap by entirej.
the class EJRWTTabPaneFormContainer method createContainer.
public Composite createContainer(Composite parent) {
if (_folder != null) {
_folder.dispose();
_folder = null;
}
int style = SWT.FLAT | SWT.BORDER | getTabOrientation() | SWT.CLOSE;
_folder = new CTabFolder(parent, style);
_folder.addCTabFolder2Listener(new CTabFolder2Adapter() {
@Override
public void close(CTabFolderEvent event) {
event.doit = false;
if (event.item instanceof CTabItem) {
EJInternalForm form = getFormByTab((CTabItem) event.item);
if (form != null) {
try {
form.close();
} catch (Exception e) {
form.getFrameworkManager().getApplicationManager().handleException(e);
}
}
}
}
});
_folder.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
CTabItem selection = _folder.getSelection();
if (selection != null && selection.getData() instanceof EJInternalForm) {
final EJInternalForm form = (EJInternalForm) selection.getData();
EJ_RWT.setAttribute(_folder, "ej-item-selection", form.getProperties().getName());
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
for (EJRWTFormSelectedListener listener : _formSelectedListeners) {
listener.fireFormSelected(form);
}
form.focusGained();
}
});
}
}
});
return _folder;
}
use of org.eclipse.swt.custom.CTabFolderEvent in project tdq-studio-se by Talend.
the class MatchingKeySection method createRuleFolder.
/**
* DOC yyin Comment method "createRuleFolder".
*
* @param parent
*/
protected void createRuleFolder(Composite parent) {
ruleFolder = new CTabFolder(parent, SWT.MULTI | SWT.BORDER);
ruleFolder.setRenderer(new MatchRuleCTabFolderRenderer(ruleFolder));
ruleFolder.setMaximizeVisible(false);
ruleFolder.setMinimizeVisible(false);
// set higher than before, because add a edit button.
ruleFolder.setTabHeight(36);
ruleFolder.setSimple(false);
ruleFolder.setDragDetect(true);
GridData folderData = new GridData(GridData.FILL_BOTH);
// folderData.verticalIndent = -26;
ruleFolder.setLayoutData(folderData);
ruleFolder.addCTabFolder2Listener(new CTabFolder2Adapter() {
@Override
public void close(CTabFolderEvent event) {
CTabItem tabItem = (CTabItem) event.item;
deleteMatchRuleTab(tabItem);
}
});
ruleFolder.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
// when the user switch the rule tab, should notify the match analysis master page to change the table
// column's color accordingly
fireSwitchRuleTabEvent();
}
});
}
use of org.eclipse.swt.custom.CTabFolderEvent in project tbd-studio-se by Talend.
the class CheckHadoopServicesDialog method createTabFolder.
private void createTabFolder(Composite parent) {
tabFolder = new CTabFolder(parent, SWT.BORDER | SWT.FLAT);
tabFolder.setLayoutData(new GridData(GridData.FILL_BOTH));
tabFolder.setLayout(new GridLayout());
tabFolder.addCTabFolder2Listener(new CTabFolder2Adapter() {
@Override
public void close(CTabFolderEvent event) {
CTabItem tabItem = (CTabItem) event.item;
serviceToException.remove(tabItem.getData());
super.close(event);
}
});
}
use of org.eclipse.swt.custom.CTabFolderEvent in project tdq-studio-se by Talend.
the class SQLEditor method createResultTabs.
/**
* Creates the results tabs in the bottom half
*
* @param parent
* @return
*/
private CTabFolder createResultTabs(Composite parent) {
tabFolder = new CTabFolder(parent, SWT.TOP | SWT.CLOSE);
tabFolder.setBorderVisible(true);
tabFolder.setLayoutData(new GridData(GridData.FILL_BOTH));
// Set up a gradient background for the selected tab
Display display = getSite().getShell().getDisplay();
tabFolder.setSelectionBackground(new Color[] { display.getSystemColor(SWT.COLOR_WHITE), firstColor, secondColor, IConstants.TAB_BORDER_COLOR }, new int[] { 25, 50, 75 }, true);
messagesTab = new CTabItem(tabFolder, SWT.NONE);
messagesTab.setText(Messages.getString("SQLEditor.Results.Messages.Caption"));
messagesTable = new Table(tabFolder, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION);
messagesTab.setControl(messagesTable);
messagesTable.setLinesVisible(true);
messagesTable.setHeaderVisible(true);
messagesTable.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
super.widgetSelected(e);
Message message = (Message) ((TableItem) e.item).getData();
setCursorPosition(message.getLineNo(), message.getCharNo());
}
});
TableColumn col = new TableColumn(messagesTable, SWT.NONE);
col.setText(Messages.getString("SQLEditor.Results.Messages.Status"));
col.pack();
col = new TableColumn(messagesTable, SWT.NONE);
col.setText(Messages.getString("SQLEditor.Results.Messages.Location"));
col.pack();
col = new TableColumn(messagesTable, SWT.NONE);
col.setText(Messages.getString("SQLEditor.Results.Messages.SQL"));
col.pack();
col = new TableColumn(messagesTable, SWT.NONE);
col.setText(Messages.getString("SQLEditor.Results.Messages.Text"));
col.pack();
tabFolder.setSelection(messagesTab);
// Add a listener to get the close button on each tab
tabFolder.addCTabFolder2Listener(new CTabFolder2Adapter() {
/*
* (non-JavaDoc)
*
* @see org.eclipse.swt.custom.CTabFolder2Adapter#close(org.eclipse.swt.custom.CTabFolderEvent)
*/
@Override
public void close(CTabFolderEvent event) {
super.close(event);
CTabItem tabItem = (CTabItem) event.item;
event.doit = onCloseTab(tabItem);
}
});
return tabFolder;
}
Aggregations