本文整理汇总了Java中org.eclipse.swt.widgets.ExpandItem.setText方法的典型用法代码示例。如果您正苦于以下问题:Java ExpandItem.setText方法的具体用法?Java ExpandItem.setText怎么用?Java ExpandItem.setText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.widgets.ExpandItem
的用法示例。
在下文中一共展示了ExpandItem.setText方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initExpandItmes
import org.eclipse.swt.widgets.ExpandItem; //导入方法依赖的package包/类
private void initExpandItmes() {
ExpandItem item1 = new ExpandItem (bar, SWT.NONE, 0);
item1.setText("Structure");
item1.setHeight(structureGroup.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
item1.setControl(structureGroup);
item1.setExpanded(true);
// ExpandItem item3 = new ExpandItem (bar, SWT.NONE, 2);
// item3.setText("Text-Style");
// item3.setHeight(textStyleWidget.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
// item3.setControl(textStyleWidget);
// item3.setExpanded(true);
}
示例2: setPluginName
import org.eclipse.swt.widgets.ExpandItem; //导入方法依赖的package包/类
private void setPluginName(ExpandItem expandItem, String name, boolean isInstalled) {
if (isInstalled) {
expandItem.setText(BaseMessages.getString(MARKET_PKG, "Marketplaces.Dialog.PluginInstalled.message", name));
} else {
expandItem.setText(BaseMessages.getString(MARKET_PKG, "Marketplaces.Dialog.PluginNotInstalled.message", name));
}
}
示例3: addExpandItem
import org.eclipse.swt.widgets.ExpandItem; //导入方法依赖的package包/类
private void addExpandItem(final ScrolledComposite scrollBarComposite)
{
final ExpandItem expandItem = new ExpandItem(expandBar, SWT.V_SCROLL);
expandItem.setExpanded(true);
if (OSValidator.isMac()) {
if (Constants.AGGREGATE.equalsIgnoreCase(component.getComponentName())
|| Constants.CUMULATE.equalsIgnoreCase(component.getComponentName())) {
expandItem.setHeight(415);
} else if (Constants.GROUP_COMBINE.equalsIgnoreCase(component.getComponentName())) {
expandItem.setHeight(460);
} else {
expandItem.setHeight(362);
}
} else if (Constants.AGGREGATE.equalsIgnoreCase(component.getComponentName())
|| Constants.CUMULATE.equalsIgnoreCase(component.getComponentName())) {
expandItem.setHeight(409);
} else if (Constants.GROUP_COMBINE.equalsIgnoreCase(component.getComponentName())) {
expandItem.setHeight(450);
} else {
expandItem.setHeight(350);
}
expandBar.addListener(SWT.MouseUp, new Listener() {
@Override
public void handleEvent(Event event) {
scrollBarComposite.setMinSize(expandBar.computeSize(SWT.DEFAULT, SWT.DEFAULT));
}
});
final OperationClassComposite operationClassComposite = createOperationClassComposite(expandItem);
final AbstractExpressionComposite expressionComposite = createExpressionComposite(expandItem,
operationClassComposite);
if (mappingSheetRowForExpression.isActive()) {
expandItem.setControl(expressionComposite);
expandItem.setText(mappingSheetRowForExpression.getOperationID());
} else if (mappingSheetRowForOperationClass.isActive()) {
expandItem.setControl(operationClassComposite);
expandItem.setText(mappingSheetRowForOperationClass.getOperationID());
}
if (!Constants.NORMALIZE.equalsIgnoreCase(component.getComponentName())) {
attachListenerOnSwitchToClassButton(expandItem, operationClassComposite, expressionComposite);
attachListenerOnSwitchToExpressiomButton(expandItem, operationClassComposite, expressionComposite);
}
showHideValidationMessage();
scrollBarComposite.setContent(expandBar);
scrollBarComposite.setMinSize(expandBar.computeSize(SWT.DEFAULT, SWT.DEFAULT));
}
示例4: main
import org.eclipse.swt.widgets.ExpandItem; //导入方法依赖的package包/类
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setLayout(new FillLayout());
shell.setText("ExpandBar Example");
ExpandBar bar = new ExpandBar(shell, SWT.V_SCROLL);
// Image image = new Image(display, "yourFile.gif");
// First item
Composite composite = new Composite(bar, SWT.NONE);
GridLayout layout = new GridLayout();
layout.marginLeft = layout.marginTop = layout.marginRight = layout.marginBottom = 10;
layout.verticalSpacing = 10;
composite.setLayout(layout);
Button button = new Button(composite, SWT.PUSH);
button.setText("SWT.PUSH");
button = new Button(composite, SWT.RADIO);
button.setText("SWT.RADIO");
button = new Button(composite, SWT.CHECK);
button.setText("SWT.CHECK");
button = new Button(composite, SWT.TOGGLE);
button.setText("SWT.TOGGLE");
ExpandItem item0 = new ExpandItem(bar, SWT.NONE, 0);
item0.setText("What is your favorite button");
item0.setHeight(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
item0.setControl(composite);
ExpandItem item1 = new ExpandItem(bar, SWT.NONE, 0);
item1.setText("What is your favorite button2");
item1.setHeight(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
Button btn = new Button(bar, SWT.PUSH);
btn.setText("hello");
item1.setControl(btn);
// item0.setImage(image);
item0.setExpanded(true);
bar.setSpacing(8);
shell.setSize(400, 350);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
// image.dispose();
display.dispose();
}
示例5: fillData
import org.eclipse.swt.widgets.ExpandItem; //导入方法依赖的package包/类
/**
* Fill data
* @param specLoaded
*/
private void fillData(Spec specLoaded)
{
if (specLoaded == null)
{
hide();
return;
} else
{
// retrieve the markers associated with the loaded spec
IMarker[] markers = TLAMarkerHelper.getProblemMarkers(specLoaded.getProject(), null);
if (markers == null || markers.length == 0)
{
hide();
}
// sort the markers
List<IMarker> markersList = new ArrayList<IMarker>(Arrays.asList(markers));
Collections.sort(markersList, new MarkerComparator());
// Bug fix: 2 June 2010. It takes forever if
// there are a large number of markers, which
// can easily happen if you remove a definition
// that's used hundreds of times.
int iterations = Math.min(markers.length, 20);
for (int j = 0; j < iterations; j++)
{
final IMarker problem = markersList.get(j);
// listener
Listener listener = new Listener() {
// goto marker on click
public void handleEvent(Event event)
{
TLAMarkerHelper.gotoMarker(problem, ((event.stateMask & SWT.CTRL) != 0));
}
};
// contents of the item
Composite problemItem = new Composite(bar, SWT.LINE_SOLID);
problemItem.setLayout(new RowLayout(SWT.VERTICAL));
problemItem.addListener(SWT.MouseDown, listener);
String[] lines = problem.getAttribute(IMarker.MESSAGE, "").split("\n");
for (int i = 0; i < lines.length; i++)
{
StyledText styledText = new StyledText(problemItem, SWT.INHERIT_DEFAULT);
styledText.setEditable(false);
styledText.setCursor(styledText.getDisplay().getSystemCursor(SWT.CURSOR_HAND));
styledText.setText(lines[i]);
styledText.addListener(SWT.MouseDown, listener);
if (isErrorLine(lines[i], problem))
{
StyleRange range = new StyleRange();
range.underline = true;
range.foreground = styledText.getDisplay().getSystemColor(SWT.COLOR_RED);
range.start = 0;
range.length = lines[i].length();
styledText.setStyleRange(range);
}
}
ExpandItem item = new ExpandItem(bar, SWT.NONE, 0);
item.setExpanded(true);
String markerType = TLAMarkerHelper.getType(problem);
item.setText(AdapterFactory.getMarkerTypeAsText(markerType) + " " + AdapterFactory.getSeverityAsText(problem.getAttribute(IMarker.SEVERITY,
IMarker.SEVERITY_ERROR)));
item.setHeight(problemItem.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
item.setControl(problemItem);
item.addListener(SWT.MouseDown, listener);
}
}
return ;
}
示例6: createLeftControlPanel
import org.eclipse.swt.widgets.ExpandItem; //导入方法依赖的package包/类
/*******************************************************
* Creates the left control panel of the graph view
*
* @param parent
* The {@link SashForm} parent of this panel
*******************************************************/
private void createLeftControlPanel(Composite parent)
{
// The expand bar
ExpandBar bar = new ExpandBar(parent, SWT.V_SCROLL);
// Create the composites of the Macro/Micro Expand Items:
// --- 1 - The Macro composite
Composite macroComp = new Composite(bar, SWT.BORDER | SWT.SHADOW_ETCHED_IN);
macroComp.setLayout(new GridLayout(1, true));
macroComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
// The enable button of the macro graph
mEnableMacroGraph = new Button(macroComp, SWT.RADIO);
mEnableMacroGraph.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
mEnableMacroGraph.setText("Enable Macro Graph");
// The list of tactics for the macro graph: contains check boxes
mMacroTactics = new Group(macroComp, SWT.BORDER | SWT.SHADOW_ETCHED_IN);
mMacroTactics.setLayout(new GridLayout(1, true));
mMacroTactics.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
mMacroTactics.setText("Select Tactics");
// --- 2 - The Micro composite
Composite microComp = new Composite(bar, SWT.BORDER | SWT.SHADOW_ETCHED_IN);
microComp.setLayout(new GridLayout(1, true));
microComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
// The enable button of the micro graph
mEnableMicroGraph = new Button(microComp, SWT.RADIO);
mEnableMicroGraph.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
mEnableMicroGraph.setText("Enable Micro Graph");
// The list of tactics for the macro graph: contains check boxes
mMicroTactics = new Group(microComp, SWT.BORDER | SWT.SHADOW_ETCHED_IN);
mMicroTactics.setLayout(new GridLayout(1, true));
mMicroTactics.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
mMicroTactics.setText("Select a Tactic");
// Create the expand items:
// 1 - The Macro Graph Expand Item
mMacroExpandItem = new ExpandItem(bar, SWT.NONE);
mMacroExpandItem.setText("Macro Graph");
mMacroExpandItem.setImage(mImageRegistry.getImage("timIcon"));
// Set the control of the expand item
mMacroExpandItem.setHeight(macroComp.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
mMacroExpandItem.setControl(macroComp);
// 2 - The Macro Graph Expand Item
mMicroExpandItem = new ExpandItem(bar, SWT.NONE);
mMicroExpandItem.setText("Micro Graph");
mMicroExpandItem.setImage(mImageRegistry.getImage("timIcon"));
// Set the control of the expand item
mMicroExpandItem.setHeight(microComp.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
mMicroExpandItem.setControl(microComp);
// Expand the macro item by default
mMacroExpandItem.setExpanded(true);
mMicroExpandItem.setExpanded(false);
}
示例7: ObjectContextView
import org.eclipse.swt.widgets.ExpandItem; //导入方法依赖的package包/类
/**
* Create the composite.
*
* @param parent
* @param style
*/
public ObjectContextView(CTApp app, AppWindow window, Composite parent, int style) {
super(parent, style);
this.app = app;
setLayout(new GridLayout(1, false));
ctools = new CTComposite(this, SWT.NONE);
ctools.setBackground(CTResourceManagerFactory.instance().getActiontitle2Background());
ctools.setForeground(CTResourceManagerFactory.instance().getActionTitle2Color());
GridLayout ctoolslayout = new GridLayout();
ctoolslayout.numColumns = 10;
ctools.setLayout(ctoolslayout);
ctools.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
CTLabel ltitle = new CTLabel(ctools, SWT.NONE);
scrolledComposite = new ScrolledComposite(this, SWT.BORDER | SWT.V_SCROLL);
scrolledComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
scrolledComposite.setExpandHorizontal(true);
scrolledComposite.setExpandVertical(true);
scrolledComposite.addListener(SWT.Resize, new Listener() {
@Override
public void handleEvent(Event arg0) {
updateLayout();
}
});
expandBar = new ExpandBar(scrolledComposite, SWT.NONE);
expandBar.setBackground(CTResourceManagerFactory.instance().getControlBg());
ExpandItem xpndtmUsedIn = new ExpandItem(expandBar, SWT.NONE);
xpndtmUsedIn.setExpanded(true);
xpndtmUsedIn.setText("Used in");
cusedin = new CTComposite(expandBar, SWT.NONE);
xpndtmUsedIn.setControl(cusedin);
xpndtmUsedIn.setHeight(xpndtmUsedIn.getControl().computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
xpndtmProperties = new ExpandItem(expandBar, SWT.NONE);
xpndtmProperties.setExpanded(true);
xpndtmProperties.setText("Properties");
propertiesview = new ObjectViewer(app, window, expandBar);
xpndtmProperties.setControl(propertiesview);
xpndtmChildren = new ExpandItem(expandBar, SWT.NONE);
xpndtmChildren.setExpanded(true);
xpndtmChildren.setText("children");
createSubpartsTable();
scrolledComposite.setContent(expandBar);
scrolledComposite.setMinSize(expandBar.computeSize(SWT.DEFAULT, SWT.DEFAULT));
ltitle.setText("Tree");
ltitle.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
propertiesview.addObjectChangeListener((e) -> {
updateLayout();
});
}
示例8: setReleaseIterations
import org.eclipse.swt.widgets.ExpandItem; //导入方法依赖的package包/类
private void setReleaseIterations(Map<Integer, Iteration> iterations) {
//
List<TableViewer>
iterationsViewers = new ArrayList<TableViewer>();
Rectangle bounds = iterationsComposite.getBounds();
/*
for (Control control : iterationsComposite.getChildren()) {
control.dispose();
}
*/
if (iterationsComposite.getChildren().length > 0) {
iterationsComposite.dispose();
iterationsComposite = toolkit.createComposite(planComposite, SWT.NULL);
iterationsComposite.setLayout(new GridLayout(1, Boolean.TRUE));
iterationsComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, Boolean.TRUE, Boolean.TRUE));
}
ExpandBar expandBar = new ExpandBar(iterationsComposite, SWT.NONE);
expandBar.setLayoutData(new GridData(SWT.FILL, SWT.FILL, Boolean.TRUE, Boolean.TRUE));
Composite expandBarComposite = toolkit.createComposite(expandBar, SWT.NULL);
// expandBarComposite.setLayout((new CustomLayout(1, Boolean.TRUE)).getLayout());
expandBarComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, Boolean.TRUE, Boolean.TRUE));
// iterationsComposite.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_GRAY)); // TODO
// For each iteration, paint User Stories
for (Iteration iteration : iterations.values()) {
ExpandItem expandItem = new ExpandItem (expandBar, SWT.NONE);
expandItem.setText(iteration.getName());
expandItem.setHeight(200);
expandItem.setExpanded(Boolean.TRUE);
Composite iterationComposite = new Composite(expandBar, SWT.NONE);
// iterationComposite.setLayout(new CustomLayout(1, Boolean.TRUE).getLayout());
iterationComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, Boolean.TRUE, Boolean.TRUE));
expandItem.setControl(iterationComposite);
iterationComposite.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_GRAY)); // TODO
TableViewer iterationUserStoriesViewer = new TableViewer(iterationComposite, SWT.BORDER
| SWT.FULL_SELECTION);
customizeViewer(iterationUserStoriesViewer);
iterationUserStoriesViewer.setContentProvider(new USContentProvider());
iterationUserStoriesViewer.setInput(iteration.getUserStories());
iterationUserStoriesViewer.setItemCount(iteration.getUserStories().size());
iterationUserStoriesViewer.getTable().setData(iteration.getId());
iterationUserStoriesViewer.getTable().setLayoutData(new GridData(SWT.FILL, SWT.FILL, Boolean.TRUE, Boolean.TRUE));
iterationUserStoriesViewer.getTable().setHeaderVisible(Boolean.TRUE);
iterationUserStoriesViewer.getTable().setSize(iterationComposite.getSize().x,
iterationComposite.getSize().y);
iterationUserStoriesViewer.getTable().setLinesVisible(Boolean.TRUE);
iterationUserStoriesViewer.refresh(Boolean.TRUE);
iterationsViewers.add(iterationUserStoriesViewer);
iterationsComposite.setBounds(bounds);
}
// DND controls
setDragControls();
setDropControls(iterationsViewers);
// DND Source/Target
setDragSource();
setDropTarget();
}