本文整理匯總了Java中org.eclipse.swt.custom.CTabItem.setData方法的典型用法代碼示例。如果您正苦於以下問題:Java CTabItem.setData方法的具體用法?Java CTabItem.setData怎麽用?Java CTabItem.setData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.swt.custom.CTabItem
的用法示例。
在下文中一共展示了CTabItem.setData方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: updateTabItems
import org.eclipse.swt.custom.CTabItem; //導入方法依賴的package包/類
public void updateTabItems() {
if(!this.isDisposed()) {
this.ignoreEvents = true;
this.disposeOrphanItems();
TGDocumentListManager documentManager = TGDocumentListManager.getInstance(this.context);
TGDocument currentDocument = documentManager.findCurrentDocument();
List<TGDocument> documents = documentManager.getDocuments();
for(int i = 0 ; i < documents.size() ; i ++) {
TGDocument document = documents.get(i);
CTabItem cTabItem = this.findTabItem(i);
cTabItem.setText(this.createTabItemLabel(document));
cTabItem.setData(document);
if( currentDocument != null && currentDocument.equals(document) ) {
this.tabFolder.setSelection(i);
}
}
this.currentUnsaved = currentDocument.isUnsaved();
this.ignoreEvents = false;
}
}
示例2: addApplication
import org.eclipse.swt.custom.CTabItem; //導入方法依賴的package包/類
public void addApplication(int index, final IWorkbenchApplication app) {
if (index < 0) {
index = 0;
}
else if (index > tabFolder.getItemCount()) {
index = tabFolder.getItemCount();
}
final CTabItem tabItem = new CTabItem(tabFolder, SWT.NONE, index);
tabItem.setText(app.getLabel());
tabItem.setImage(ImageHelper.getImage(
app.getIcon(),
PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_ELEMENT)));
tabItem.setToolTipText(app.getTooltip());
final WorkbenchApplicationTree appTree = new WorkbenchApplicationTree(tabFolder, app, this);
final WorkbenchApplicationContext context = new WorkbenchApplicationContext(workbenchContext, app, appTree);
tabItem.setControl(appTree);
tabItem.setData(app);
tabItem.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(final DisposeEvent e) {
app.onDispose();
}
});
app.onContextInitialize(context);
}
示例3: createUnformattedViewTabItem
import org.eclipse.swt.custom.CTabItem; //導入方法依賴的package包/類
/**
*
* Create unformatted view tab in data viewer tab folder
*
*/
public void createUnformattedViewTabItem() {
if (isViewTabExist(Views.UNFORMATTED_VIEW_NAME)) {
CTabItem item = getViewTabItem(Views.UNFORMATTED_VIEW_NAME);
tabFolder.setSelection(item);
dataViewLoader.reloadloadViews();
return;
}
CTabItem tbtmUnformattedView = new CTabItem(tabFolder, SWT.CLOSE);
tbtmUnformattedView.setData(Views.VIEW_NAME_KEY, Views.UNFORMATTED_VIEW_NAME);
tbtmUnformattedView.setText(Views.UNFORMATTED_VIEW_DISPLAY_NAME);
{
Composite composite = new Composite(tabFolder, SWT.NONE);
tbtmUnformattedView.setControl(composite);
composite.setLayout(new GridLayout(1, false));
{
unformattedViewTextarea = new StyledText(composite, SWT.BORDER | SWT.READ_ONLY | SWT.V_SCROLL
| SWT.H_SCROLL);
unformattedViewTextarea.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
}
}
tabFolder.setSelection(tbtmUnformattedView);
dataViewLoader.setUnformattedViewTextarea(unformattedViewTextarea);
dataViewLoader.reloadloadViews();
actionFactory.getAction(SelectColumnAction.class.getName()).setEnabled(false);
}
示例4: createFormatedViewTabItem
import org.eclipse.swt.custom.CTabItem; //導入方法依賴的package包/類
/**
*
* Create formatted view tab in data viewer tab folder
*
*/
public void createFormatedViewTabItem() {
if (isViewTabExist(Views.FORMATTED_VIEW_NAME)) {
CTabItem item = getViewTabItem(Views.FORMATTED_VIEW_NAME);
tabFolder.setSelection(item);
dataViewLoader.reloadloadViews();
return;
}
CTabItem tbtmFormattedView = new CTabItem(tabFolder, SWT.CLOSE);
tbtmFormattedView.setData(Views.VIEW_NAME_KEY, Views.FORMATTED_VIEW_NAME);
tbtmFormattedView.setText(Views.FORMATTED_VIEW_DISPLAYE_NAME);
{
Composite composite = new Composite(tabFolder, SWT.NONE);
tbtmFormattedView.setControl(composite);
composite.setLayout(new GridLayout(1, false));
{
formattedViewTextarea = new StyledText(composite, SWT.BORDER | SWT.READ_ONLY | SWT.H_SCROLL
| SWT.V_SCROLL);
formattedViewTextarea.setFont(SWTResourceManager.getFont("Courier New", 9, SWT.NORMAL));
formattedViewTextarea.setEditable(false);
formattedViewTextarea.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
}
}
tabFolder.setSelection(tbtmFormattedView);
dataViewLoader.setFormattedViewTextarea(formattedViewTextarea);
dataViewLoader.reloadloadViews();
}
示例5: createRelationTabItem
import org.eclipse.swt.custom.CTabItem; //導入方法依賴的package包/類
private void createRelationTabItem(CTabFolder folder) {
CTabItem tbtmMain = new CTabItem(folder, SWT.NONE);
tbtmMain.setText("Relations");
tbtmMain.setData("relation", "relation");
final ScrolledComposite scrollComposite = new ScrolledComposite(folder,
SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
final Composite relationsComp = new Composite(scrollComposite, SWT.NONE);
tbtmMain.setControl(scrollComposite);
scrollComposite.setContent(relationsComp);
scrollComposite.setExpandVertical(true);
scrollComposite.setExpandHorizontal(true);
scrollComposite.addControlListener(new ControlAdapter() {
@Override
public void controlResized(ControlEvent e) {
Rectangle r = scrollComposite.getClientArea();
scrollComposite.setMinSize(relationsComp.computeSize(r.width,
SWT.DEFAULT));
}
});
relationsComp.setLayout(new GridLayout(
BTSUIConstants.PASSPORT_COLUMN_NUMBER, true));
((GridLayout) relationsComp.getLayout()).marginWidth = 0;
((GridLayout) relationsComp.getLayout()).marginHeight = 0;
}
示例6: createIdentifiersTabItem
import org.eclipse.swt.custom.CTabItem; //導入方法依賴的package包/類
private void createIdentifiersTabItem(CTabFolder folder) {
CTabItem tbtmMain = new CTabItem(folder, SWT.NONE);
tbtmMain.setText("IDs");
tbtmMain.setToolTipText("External Identifiers");
tbtmMain.setData("id", "id");
final ScrolledComposite scrollComposite = new ScrolledComposite(folder,
SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
final Composite idsComp = new Composite(scrollComposite, SWT.NONE);
tbtmMain.setControl(scrollComposite);
scrollComposite.setContent(idsComp);
scrollComposite.setExpandVertical(true);
scrollComposite.setExpandHorizontal(true);
scrollComposite.addControlListener(new ControlAdapter() {
@Override
public void controlResized(ControlEvent e) {
Rectangle r = scrollComposite.getClientArea();
scrollComposite.setMinSize(idsComp.computeSize(r.width,
SWT.DEFAULT));
}
});
idsComp.setLayout(new GridLayout(
BTSUIConstants.PASSPORT_COLUMN_NUMBER, true));
((GridLayout) idsComp.getLayout()).marginWidth = 0;
((GridLayout) idsComp.getLayout()).marginHeight = 0;
}
示例7: checkAndReload
import org.eclipse.swt.custom.CTabItem; //導入方法依賴的package包/類
private void checkAndReload(Command command) {
if (command instanceof DeleteCommand
|| command instanceof CompoundCommand
|| command instanceof AddCommand
|| command instanceof RemoveCommand) {
CTabItem tabItem = tabFolder.getSelection();
reloadGenericTabItem(tabItem);
tabItem.setData("reloaded", genericTabsReloadRequiredCounter++);
}
}
示例8: createNewSearchTab
import org.eclipse.swt.custom.CTabItem; //導入方法依賴的package包/類
private void createNewSearchTab(BTSQueryRequest query, String queryName) {
// create main tab item
CTabItem searchTab = new CTabItem(tabFolder, SWT.NONE);
searchTab.setShowClose(true);
searchTab.setImage(resourceProvider.getImage(Display.getCurrent(), BTSResourceProvider.IMG_SEARCH));
if (queryName != null && queryName.trim().length() > 0)
{
searchTab.setText(queryName);
}
else
{
searchTab.setText(new Integer(tabFolder.getChildren().length - 2).toString());
}
searchTab.setData("key", query.getQueryId());
Composite searchTabItemComp = new Composite(tabFolder, SWT.NONE);
searchTabItemComp.setLayoutData(new GridData(GridData.FILL_BOTH));
searchTabItemComp.setLayout(new GridLayout());
((GridLayout) searchTabItemComp.getLayout()).marginHeight = 0;
((GridLayout) searchTabItemComp.getLayout()).marginWidth = 0;
searchTab.setControl(searchTabItemComp);
TreeViewer searchTreeViewer = new TreeViewer(searchTabItemComp);
searchTreeViewer.getTree()
.setLayoutData(new GridData(GridData.FILL_BOTH));
searchTreeViewer.getTree().setLayout(new GridLayout());
searchTab.setData("tv", searchTreeViewer);
searchTabItemComp.layout();
tabFolder.setSelection(searchTab);
TreeNodeWrapper searchRootNode = BtsviewmodelFactory.eINSTANCE.createTreeNodeWrapper();
prepareTreeViewer(searchTreeViewer, searchTabItemComp);
// search
searchInput(searchTabItemComp, searchTreeViewer, searchRootNode, query, searchTab);
}
示例9: createHorizantalViewTabItem
import org.eclipse.swt.custom.CTabItem; //導入方法依賴的package包/類
private void createHorizantalViewTabItem() {
CTabItem tbtmHorizantalView = new CTabItem(tabFolder, SWT.CLOSE);
tbtmHorizantalView.setData(Views.VIEW_NAME_KEY, Views.HORIZONTAL_VIEW_NAME);
tbtmHorizantalView.setText(Views.HORIZONTAL_VIEW_DISPLAY_NAME);
{
Composite composite = new Composite(tabFolder, SWT.NONE);
tbtmHorizantalView.setControl(composite);
composite.setLayout(new GridLayout(1, false));
{
ScrolledComposite scrolledComposite = new ScrolledComposite(composite, SWT.BORDER | SWT.H_SCROLL
| SWT.V_SCROLL);
scrolledComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
scrolledComposite.setExpandHorizontal(true);
scrolledComposite.setExpandVertical(true);
Composite stackLayoutComposite = new Composite(scrolledComposite, SWT.NONE);
StackLayout stackLayout = new StackLayout();
stackLayoutComposite.setLayout(stackLayout);
{
Composite composite_4 = new Composite(stackLayoutComposite, SWT.NONE);
GridLayout gl_composite_4 = new GridLayout(1, false);
gl_composite_4.verticalSpacing = 0;
gl_composite_4.marginWidth = 0;
gl_composite_4.marginHeight = 0;
gl_composite_4.horizontalSpacing = 0;
composite_4.setLayout(gl_composite_4);
{
horizontalViewTableViewer = new TableViewer(composite_4, SWT.BORDER | SWT.FULL_SELECTION);
Table table_1 = horizontalViewTableViewer.getTable();
table_1.setLinesVisible(true);
table_1.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
}
stackLayout.topControl = composite_4;
}
scrolledComposite.getShowFocusedControl();
scrolledComposite.setShowFocusedControl(true);
scrolledComposite.setContent(stackLayoutComposite);
scrolledComposite.setMinSize(stackLayoutComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
installMouseWheelScrollRecursively(scrolledComposite);
setTableLayoutToMappingTable(horizontalViewTableViewer);
horizontalViewTableViewer.setContentProvider(new ArrayContentProvider());
dataViewLoader.updateDataViewLists();
horizontalViewTableViewer.setInput(gridViewData);
horizontalViewTableViewer.refresh();
for (int i = 0, n = horizontalViewTableViewer.getTable().getColumnCount(); i < n; i++)
horizontalViewTableViewer.getTable().getColumn(i).pack();
horizontalViewTableViewer.refresh();
}
}
}
示例10: tabSelected
import org.eclipse.swt.custom.CTabItem; //導入方法依賴的package包/類
private void tabSelected(CTabItem item) {
if (item.getData() instanceof IConfigurationElement) {
final IConfigurationElement element = (IConfigurationElement) item
.getData();
Composite pageComposite = (Composite) item.getControl();
try {
final InstallationPage page = (InstallationPage) element
.createExecutableExtension(IWorkbenchRegistryConstants.ATT_CLASS);
page.createControl(pageComposite);
// new controls created since the dialog font was applied, so
// apply again.
Dialog.applyDialogFont(pageComposite);
page.setPageContainer(this);
// Must be done before creating the buttons because the control
// button creation methods
// use this map.
pageToId.put(page, element
.getAttribute(IWorkbenchRegistryConstants.ATT_ID));
createButtons(page);
item.setData(page);
item.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
page.dispose();
}
});
pageComposite.layout(true, true);
} catch (CoreException e1) {
Label label = new Label(pageComposite, SWT.NONE);
label.setText(e1.getMessage());
item.setData(null);
}
}
String id = (String) item.getData(ID);
rememberSelectedTab(id);
buttonManager.update(id);
Button button = createButton(buttonManager.getParent(),
IDialogConstants.CLOSE_ID, IDialogConstants.CLOSE_LABEL, true);
GridData gd = (GridData) button.getLayoutData();
gd.horizontalAlignment = SWT.BEGINNING;
gd.horizontalIndent = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH) / 2;
// Layout the button bar's parent and all of its children. We must
// cascade through all children because the buttons have changed and
// because tray dialog inserts an extra composite in the button bar
// hierarchy.
getButtonBar().getParent().layout(true, true);
}
示例11: createNewSearchTab
import org.eclipse.swt.custom.CTabItem; //導入方法依賴的package包/類
private void createNewSearchTab(BTSQueryRequest query, String queryName, List<BTSCorpusObject> objects) {
// create main tab item
CTabItem searchTab = new CTabItem(tabFolder, SWT.NONE);
searchTab.setShowClose(true);
searchTab.setImage(resourceProvider.getImage(Display.getCurrent(), BTSResourceProvider.IMG_SEARCH));
if (queryName != null && queryName.trim().length() > 0)
{
searchTab.setText(queryName);
}
else
{
searchTab.setText(new Integer(tabFolder.getChildren().length - 2).toString());
}
if (query != null)
{
searchTab.setData("key", query.getQueryId());
}
Composite searchTabItemComp = new Composite(tabFolder, SWT.NONE);
searchTabItemComp.setLayoutData(new GridData(GridData.FILL_BOTH));
searchTabItemComp.setLayout(new GridLayout());
((GridLayout) searchTabItemComp.getLayout()).marginHeight = 0;
((GridLayout) searchTabItemComp.getLayout()).marginWidth = 0;
searchTab.setControl(searchTabItemComp);
TreeViewer searchTreeViewer = new TreeViewer(searchTabItemComp);
searchTreeViewer.getTree()
.setLayoutData(new GridData(GridData.FILL_BOTH));
searchTreeViewer.getTree().setLayout(new GridLayout());
searchTab.setData("tv", searchTreeViewer);
searchTabItemComp.layout();
tabFolder.setSelection(searchTab);
TreeNodeWrapper searchRootNode = BtsviewmodelFactory.eINSTANCE.createTreeNodeWrapper();
prepareTreeViewer(searchTreeViewer, searchTabItemComp);
// search
searchInput(searchTabItemComp, searchTreeViewer, searchRootNode, query, objects, searchTab);
}