use of org.eclipse.swt.graphics.Cursor in project eclipse.platform.swt by eclipse.
the class AddressBook method findEntry.
private boolean findEntry() {
Cursor waitCursor = shell.getDisplay().getSystemCursor(SWT.CURSOR_WAIT);
shell.setCursor(waitCursor);
boolean matchCase = searchDialog.getMatchCase();
boolean matchWord = searchDialog.getMatchWord();
String searchString = searchDialog.getSearchString();
int column = searchDialog.getSelectedSearchArea();
searchString = matchCase ? searchString : searchString.toLowerCase();
boolean found = false;
if (searchDialog.getSearchDown()) {
for (int i = table.getSelectionIndex() + 1; i < table.getItemCount(); i++) {
if (found = findMatch(searchString, table.getItem(i), column, matchWord, matchCase)) {
table.setSelection(i);
break;
}
}
} else {
for (int i = table.getSelectionIndex() - 1; i > -1; i--) {
if (found = findMatch(searchString, table.getItem(i), column, matchWord, matchCase)) {
table.setSelection(i);
break;
}
}
}
shell.setCursor(null);
return found;
}
use of org.eclipse.swt.graphics.Cursor in project eclipse.platform.swt by eclipse.
the class Test_org_eclipse_swt_widgets_Control method test_setCursorLorg_eclipse_swt_graphics_Cursor.
@Test
public void test_setCursorLorg_eclipse_swt_graphics_Cursor() {
control.setCursor(null);
Cursor c = new Cursor(control.getDisplay(), 0);
control.setCursor(c);
c.dispose();
}
use of org.eclipse.swt.graphics.Cursor in project yamcs-studio by yamcs.
the class SWTResourceManager method getCursor.
/**
* Returns the system cursor matching the specific ID.
*
* @param id
* int The ID value for the cursor
* @return Cursor The system cursor matching the specific ID
*/
public static Cursor getCursor(int id) {
Integer key = Integer.valueOf(id);
Cursor cursor = m_idToCursorMap.get(key);
if (cursor == null) {
cursor = new Cursor(Display.getDefault(), id);
m_idToCursorMap.put(key, cursor);
}
return cursor;
}
use of org.eclipse.swt.graphics.Cursor in project cubrid-manager by CUBRID.
the class AboutDialog method createDialogArea.
/**
* Creates the page content
*
* @param parent the parent composite to contain the dialog area
* @return the dialog area control
*/
protected Control createDialogArea(Composite parent) {
final Cursor hand = new Cursor(parent.getDisplay(), SWT.CURSOR_HAND);
final Cursor busy = new Cursor(parent.getDisplay(), SWT.CURSOR_WAIT);
setHandCursor(hand);
setBusyCursor(busy);
getShell().addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent event) {
setHandCursor(null);
hand.dispose();
setBusyCursor(null);
busy.dispose();
}
});
// brand the about box if there is product info
Image aboutImage = null;
if (product != null && aboutImageDescriptor != null) {
aboutImage = aboutImageDescriptor.createImage();
}
Composite workArea = new Composite(parent, SWT.NONE);
GridLayout workLayout = new GridLayout();
workLayout.marginHeight = 0;
workLayout.marginWidth = 0;
workLayout.verticalSpacing = 0;
workLayout.horizontalSpacing = 0;
workArea.setLayout(workLayout);
workArea.setLayoutData(new GridData(GridData.FILL_BOTH));
// page group
Color background = JFaceColors.getBannerBackground(parent.getDisplay());
Color foreground = JFaceColors.getBannerForeground(parent.getDisplay());
Composite top = (Composite) super.createDialogArea(workArea);
// override any layout inherited from createDialogArea
GridLayout layout = new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
layout.verticalSpacing = 0;
layout.horizontalSpacing = 0;
top.setLayout(layout);
top.setLayoutData(new GridData(GridData.FILL_BOTH));
top.setBackground(background);
top.setForeground(foreground);
// the image & text
Composite topContainer = new Composite(top, SWT.NONE);
topContainer.setBackground(background);
topContainer.setForeground(foreground);
layout = new GridLayout();
layout.numColumns = (aboutImage == null || getItem() == null ? 1 : 2);
layout.marginWidth = 0;
layout.marginHeight = 0;
layout.verticalSpacing = 0;
layout.horizontalSpacing = 0;
topContainer.setLayout(layout);
GridData data = new GridData();
data.horizontalAlignment = GridData.FILL;
data.grabExcessHorizontalSpace = true;
topContainer.setLayoutData(data);
// image on left side of dialog
if (aboutImage != null) {
Label imageLabel = new Label(topContainer, SWT.NONE);
imageLabel.setBackground(background);
imageLabel.setForeground(foreground);
data = new GridData();
data.horizontalAlignment = GridData.FILL;
data.verticalAlignment = GridData.BEGINNING;
data.grabExcessHorizontalSpace = false;
imageLabel.setLayoutData(data);
imageLabel.setImage(aboutImage);
}
if (getItem() != null) {
Composite textContainer = new Composite(topContainer, SWT.NONE);
textContainer.setBackground(background);
textContainer.setForeground(foreground);
layout = new GridLayout();
layout.numColumns = 1;
textContainer.setLayout(layout);
data = new GridData();
data.horizontalAlignment = GridData.FILL;
data.verticalAlignment = GridData.BEGINNING;
data.grabExcessHorizontalSpace = true;
textContainer.setLayoutData(data);
// text on the right
text = new StyledText(textContainer, SWT.MULTI | SWT.READ_ONLY);
text.setCaret(null);
text.setFont(parent.getFont());
data = new GridData();
data.horizontalAlignment = GridData.FILL;
data.verticalAlignment = GridData.BEGINNING;
data.grabExcessHorizontalSpace = true;
text.setText(getItem().getText());
text.setLayoutData(data);
text.setCursor(null);
text.setBackground(background);
text.setForeground(foreground);
setLinkRanges(text, getItem().getLinkRanges());
addListeners(text);
}
// horizontal bar
Label bar = new Label(workArea, SWT.HORIZONTAL | SWT.SEPARATOR);
data = new GridData();
data.horizontalAlignment = GridData.FILL;
bar.setLayoutData(data);
// add image buttons for bundle groups that have them
Composite bottom = (Composite) super.createDialogArea(workArea);
// override any layout inherited from createDialogArea
layout = new GridLayout();
bottom.setLayout(layout);
bottom.setLayoutData(new GridData(GridData.FILL_BOTH));
// spacer
bar = new Label(bottom, SWT.NONE);
data = new GridData();
data.horizontalAlignment = GridData.FILL;
bar.setLayoutData(data);
return workArea;
}
use of org.eclipse.swt.graphics.Cursor in project cogtool by cogtool.
the class WindowUtil method getClosedHandCursor.
public static Cursor getClosedHandCursor() {
if (CLOSED_HAND_CURSOR == null) {
ImageData curData = GraphicsUtil.getImageDataFromResource("edu/cmu/cs/hcii/cogtool/resources/closed_hand.gif");
if (curData == null) {
return null;
}
CLOSED_HAND_CURSOR = new Cursor(GLOBAL_DISPLAY, curData, 8, 8);
}
return CLOSED_HAND_CURSOR;
}
Aggregations