org.eclipse.swt.graphics.Cursor Java Examples
The following examples show how to use
org.eclipse.swt.graphics.Cursor.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: StatechartDefinitionSection.java From statecharts with Eclipse Public License 1.0 | 6 votes |
protected Label createSwitchControl() { Label switchControl = new Label(this, SWT.PUSH); switchControl.setToolTipText(sectionExpanded ? HIDE_SECTION_TOOLTIP : SHOW_SECTION_TOOLTIP); switchControl.setImage(sectionExpanded ? StatechartImages.COLLAPSE.image() : StatechartImages.EXPAND.image()); switchControl.setCursor(new Cursor(getDisplay(), SWT.CURSOR_HAND)); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).indent(-1, -1).hint(MIN_SIZE[0], MIN_SIZE[1]) .applyTo(switchControl); mouseListener = new MouseAdapter() { @Override public void mouseUp(MouseEvent e) { toggleExpandState(); } }; switchControl.addMouseListener(mouseListener); return switchControl; }
Example #2
Source File: DbTab.java From Rel with Apache License 2.0 | 6 votes |
/** Open a connection and associated panel. */ private boolean openConnection(String dbURL, boolean permanent, boolean canCreate) { Cursor oldCursor = getParent().getCursor(); getParent().setCursor(new Cursor(getParent().getDisplay(), SWT.CURSOR_WAIT)); try { setText(dbURL); if (!DBrowser.hasLocalRel() && dbURL.startsWith("db:")) { doConnectionResultFailed(new Throwable("Local Rel server is not installed."), dbURL); return false; } connection = attemptConnectionOpen(dbURL, canCreate); if (connection.client != null) { doConnectionResultSuccess(connection.client, dbURL, permanent); return true; } else { doConnectionResultFailed(connection.exception, dbURL); return false; } } finally { getParent().getCursor().dispose(); getParent().setCursor(oldCursor); } }
Example #3
Source File: ValidatorDialog.java From pentaho-kettle with Apache License 2.0 | 6 votes |
private void getFields() { Cursor busy = new Cursor( shell.getDisplay(), SWT.CURSOR_WAIT ); shell.setCursor( busy ); try { String sourceStepName = wSourceStep.getText(); if ( !Utils.isEmpty( sourceStepName ) ) { String fieldName = wSourceField.getText(); RowMetaInterface r = transMeta.getStepFields( sourceStepName ); if ( r != null ) { wSourceField.setItems( r.getFieldNames() ); } wSourceField.setText( fieldName ); } shell.setCursor( null ); busy.dispose(); } catch ( KettleException ke ) { shell.setCursor( null ); busy.dispose(); new ErrorDialog( shell, BaseMessages.getString( PKG, "ValidatorDialog.FailedToGetFields.DialogTitle" ), BaseMessages .getString( PKG, "ValidatorDialog.FailedToGetFields.DialogMessage" ), ke ); } }
Example #4
Source File: DbTab.java From Rel with Apache License 2.0 | 6 votes |
private void showCmd() { boolean existing = true; if (contentCmd == null) { existing = false; Cursor oldCursor = getParent().getCursor(); getParent().setCursor(new Cursor(getParent().getDisplay(), SWT.CURSOR_WAIT)); try { contentCmd = new DbTabContentCmd(DbTab.this, modeContent); getParent().getCursor().dispose(); getParent().setCursor(oldCursor); } catch (Exception e) { getParent().getCursor().dispose(); getParent().setCursor(oldCursor); e.printStackTrace(); MessageDialog.openError(Core.getShell(), "Unable to open local database", wrapped("Unable to open command line due to error: " + e.toString())); return; } } contentStack.topControl = contentCmd; modeContent.layout(); if (existing) contentCmd.redisplayed(); }
Example #5
Source File: DbTab.java From Rel with Apache License 2.0 | 6 votes |
private void showRev() { boolean existing = true; if (contentRev == null) { existing = false; Cursor oldCursor = getParent().getCursor(); getParent().setCursor(new Cursor(getParent().getDisplay(), SWT.CURSOR_WAIT)); try { contentRev = new DbTabContentRev(DbTab.this, modeContent); } finally { getParent().getCursor().dispose(); getParent().setCursor(oldCursor); } } contentStack.topControl = contentRev; modeContent.layout(); if (existing) contentRev.redisplayed(); }
Example #6
Source File: XYGraphMediaFactory.java From nebula with Eclipse Public License 2.0 | 6 votes |
/** * Private constructor to avoid instantiation. */ private XYGraphMediaFactory() { _colorRegistry = new ColorRegistry(); _imageRegistry = new ImageRegistry(); _fontRegistry = new FontRegistry(); cursorRegistry = new HashMap<String, Cursor>(); _imageCache = new HashMap<ImageDescriptor, Image>(); // dispose all images from the image cache, when the display is disposed Display.getDefault().addListener(SWT.Dispose, new Listener() { public void handleEvent(final Event event) { for (Image img : _imageCache.values()) { img.dispose(); } disposeResources(); } }); }
Example #7
Source File: DbTab.java From Rel with Apache License 2.0 | 6 votes |
private void showRel() { boolean existing = true; if (contentRel == null) { existing = false; Cursor oldCursor = getParent().getCursor(); getParent().setCursor(new Cursor(getParent().getDisplay(), SWT.CURSOR_WAIT)); try { contentRel = new DbTabContentRel(DbTab.this, modeContent); } finally { getParent().getCursor().dispose(); getParent().setCursor(oldCursor); } } contentStack.topControl = contentRel; modeContent.layout(); if (existing) contentRel.redisplayed(); contentRel.activateMenu(); }
Example #8
Source File: DbTab.java From Rel with Apache License 2.0 | 6 votes |
private void showRecentlyUsedList() { boolean existing = true; if (contentRecent == null) { existing = false; Cursor oldCursor = getParent().getCursor(); getParent().setCursor(new Cursor(getParent().getDisplay(), SWT.CURSOR_WAIT)); try { contentRecent = new DbTabContentRecent(DbTab.this, modeContent); } finally { getParent().getCursor().dispose(); getParent().setCursor(oldCursor); } } contentStack.topControl = contentRecent; modeContent.layout(); if (existing) contentRecent.redisplayed(); }
Example #9
Source File: AlwStartPage.java From XPagesExtensionLibrary with Apache License 2.0 | 6 votes |
protected AlwStartPage() { super(""); setTitle("Application Layout"); // $NLX-AlwStartPage.ApplicationLayout-1$ setMessage("Choose the configuration for this control.", IMessageProvider.INFORMATION); // $NLX-AlwStartPage.Choosetheconfigurationforthiscont-1$ // Setup the title font _titleFont = JFaceResources.getBannerFont(); // Setup hand cursor _handCursor = new Cursor(Display.getCurrent(), SWT.CURSOR_HAND); // Load images - Do not have to be disposed later - plugin maintains a list _defImage = ExtLibToolingPlugin.getImage("app_layout.jpg"); // $NON-NLS-1$ if (_showResponsiveIcon) { _responsiveImage = NavigatorPlugin.getImage("navigatorIcons/navigatorChild.png"); // $NON-NLS-1$ } else { _responsiveImage = null; } // Setup hyperlink color _hyperlinkColor = new Color(Display.getCurrent(), 0, 0, 255); }
Example #10
Source File: ReportNonResizableHandleKit.java From birt with Eclipse Public License 1.0 | 6 votes |
/** * Fills the given List with handles at each corner of a figure. * * @param part * the handles' GraphicalEditPart * @param handles * the List to add the four corner handles to * @param tracker * the handles' DragTracker * @param cursor * the handles' Cursor */ public static void addCornerHandles( GraphicalEditPart part, List handles, DragTracker tracker, Cursor cursor ) { handles.add( createHandle( part, PositionConstants.SOUTH_EAST, tracker, cursor ) ); handles.add( createHandle( part, PositionConstants.SOUTH_WEST, tracker, cursor ) ); handles.add( createHandle( part, PositionConstants.NORTH_WEST, tracker, cursor ) ); handles.add( createHandle( part, PositionConstants.NORTH_EAST, tracker, cursor ) ); }
Example #11
Source File: Sleak.java From AppleCommander with GNU General Public License v2.0 | 6 votes |
void refreshLabel () { int colors = 0, cursors = 0, fonts = 0, gcs = 0, images = 0, regions = 0; for (int i=0; i<objects.length; i++) { Object object = objects [i]; if (object instanceof Color) colors++; if (object instanceof Cursor) cursors++; if (object instanceof Font) fonts++; if (object instanceof GC) gcs++; if (object instanceof Image) images++; if (object instanceof Region) regions++; } String string = ""; //$NON-NLS-1$ if (colors != 0) string += colors + " Color(s)\n"; //$NON-NLS-1$ if (cursors != 0) string += cursors + " Cursor(s)\n"; //$NON-NLS-1$ if (fonts != 0) string += fonts + " Font(s)\n"; //$NON-NLS-1$ if (gcs != 0) string += gcs + " GC(s)\n"; //$NON-NLS-1$ if (images != 0) string += images + " Image(s)\n"; //$NON-NLS-1$ if (regions != 0) string += regions + " Region(s)\n"; //$NON-NLS-1$ if (string.length () != 0) { string = string.substring (0, string.length () - 1); } label.setText (string); }
Example #12
Source File: ProgressDialog.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
public void showFinish(String finishMessage) { progressLabel.setText(finishMessage); shell.layout(); display.update(); shell.setCursor(new Cursor(proShell.getDisplay(), SWT.CURSOR_ARROW)); proShell.setCursor(new Cursor(proShell.getDisplay(), SWT.CURSOR_ARROW)); }
Example #13
Source File: XLFEditor.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
@Override public void init(IEditorSite site, IEditorInput input) throws PartInitException { if (LOGGER.isDebugEnabled()) { LOGGER.debug("init(IEditorSite site, IEditorInput input)"); } setSite(site); setInput(input); // 设置Editor标题栏的显示名称,否则名称用plugin.xml中的name属性 setPartName(input.getName()); Image oldTitleImage = titleImage; if (input != null) { IEditorRegistry editorRegistry = PlatformUI.getWorkbench().getEditorRegistry(); IEditorDescriptor editorDesc = editorRegistry.findEditor(getSite().getId()); ImageDescriptor imageDesc = editorDesc != null ? editorDesc.getImageDescriptor() : null; titleImage = imageDesc != null ? imageDesc.createImage() : null; } setTitleImage(titleImage); if (oldTitleImage != null && !oldTitleImage.isDisposed()) { oldTitleImage.dispose(); } getSite().setSelectionProvider(this); cursorIbeam = new Cursor(null, SWT.CURSOR_IBEAM); cursorArrow = new Cursor(null, SWT.CURSOR_ARROW); hookListener(); }
Example #14
Source File: CrosstabRowDragTracker.java From birt with Eclipse Public License 1.0 | 5 votes |
@Override protected Cursor getDefaultCursor( ) { if (isCloneActive()) { return Cursors.SIZENS; } return super.getDefaultCursor( ); }
Example #15
Source File: SWTResourceManager.java From Rel with Apache License 2.0 | 5 votes |
/** * Dispose all of the cached cursors. */ public static void disposeCursors() { for (Cursor cursor : m_idToCursorMap.values()) { cursor.dispose(); } m_idToCursorMap.clear(); }
Example #16
Source File: HsAbstractProgressDialog.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
/** * 设置鼠标 */ private void setDisplayCursor(Cursor c) { Shell[] shells = getShell().getDisplay().getShells(); for (int i = 0; i < shells.length; i++) { shells[i].setCursor(c); } }
Example #17
Source File: ProgressDialog.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
public void showFinish(String finishMessage) { progressLabel.setText(finishMessage); shell.layout(); display.update(); shell.setCursor(new Cursor(proShell.getDisplay(), SWT.CURSOR_ARROW)); proShell.setCursor(new Cursor(proShell.getDisplay(), SWT.CURSOR_ARROW)); }
Example #18
Source File: SWTResourceManager.java From Flashtool with GNU General Public License v3.0 | 5 votes |
/** * Dispose all of the cached cursors. */ public static void disposeCursors() { for (Cursor cursor : m_idToCursorMap.values()) { cursor.dispose(); } m_idToCursorMap.clear(); }
Example #19
Source File: SWTResourceManager.java From developer-studio with Apache License 2.0 | 5 votes |
/** * Dispose all of the cached cursors. */ public static void disposeCursors() { for (Cursor cursor : m_idToCursorMap.values()) { cursor.dispose(); } m_idToCursorMap.clear(); }
Example #20
Source File: BulletListBlock.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private Control createControl(Composite parent) { fStyledText= new StyledText(parent, SWT.FLAT | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); fStyledText.setEditable(false); Cursor arrowCursor= fStyledText.getDisplay().getSystemCursor(SWT.CURSOR_ARROW); fStyledText.setCursor(arrowCursor); // Don't set caret to 'null' as this causes https://bugs.eclipse.org/293263 // fStyledText.setCaret(null); final GridData data= new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL); fStyledText.setLayoutData(data); configureStyledText(fText, fEnabled); return fStyledText; }
Example #21
Source File: JavaPreview.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public JavaPreview(Map<String, String> workingValues, Composite parent) { JavaTextTools tools= JavaPlugin.getDefault().getJavaTextTools(); fPreviewDocument= new Document(); fWorkingValues= workingValues; tools.setupJavaDocumentPartitioner( fPreviewDocument, IJavaPartitions.JAVA_PARTITIONING); PreferenceStore prioritizedSettings= new PreferenceStore(); HashMap<String, String> complianceOptions= new HashMap<String, String>(); JavaModelUtil.setComplianceOptions(complianceOptions, JavaModelUtil.VERSION_LATEST); for (Entry<String, String> complianceOption : complianceOptions.entrySet()) { prioritizedSettings.setValue(complianceOption.getKey(), complianceOption.getValue()); } IPreferenceStore[] chain= { prioritizedSettings, JavaPlugin.getDefault().getCombinedPreferenceStore() }; fPreferenceStore= new ChainedPreferenceStore(chain); fSourceViewer= new JavaSourceViewer(parent, null, null, false, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER, fPreferenceStore); fSourceViewer.setEditable(false); Cursor arrowCursor= fSourceViewer.getTextWidget().getDisplay().getSystemCursor(SWT.CURSOR_ARROW); fSourceViewer.getTextWidget().setCursor(arrowCursor); // Don't set caret to 'null' as this causes https://bugs.eclipse.org/293263 // fSourceViewer.getTextWidget().setCaret(null); fViewerConfiguration= new SimpleJavaSourceViewerConfiguration(tools.getColorManager(), fPreferenceStore, null, IJavaPartitions.JAVA_PARTITIONING, true); fSourceViewer.configure(fViewerConfiguration); fSourceViewer.getTextWidget().setFont(JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT)); fMarginPainter= new MarginPainter(fSourceViewer); final RGB rgb= PreferenceConverter.getColor(fPreferenceStore, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLOR); fMarginPainter.setMarginRulerColor(tools.getColorManager().getColor(rgb)); fSourceViewer.addPainter(fMarginPainter); new JavaSourcePreviewerUpdater(); fSourceViewer.setDocument(fPreviewDocument); }
Example #22
Source File: SWTResourceManager.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
/** * Dispose all of the cached cursors. */ public static void disposeCursors() { for (Cursor cursor : m_idToCursorMap.values()) { cursor.dispose(); } m_idToCursorMap.clear(); }
Example #23
Source File: SwtEventHandler.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * The constructor. * @param Interactive Renderer * @param swtRendererImpl * * @param _lhmAllTriggers * @param _jc * @param _lcl */ SwtEventHandler(InteractiveRenderer iv, LinkedHashMap<TriggerCondition, List<RegionAction>> _lhmAllTriggers, IUpdateNotifier _jc, ULocale _lcl ) { lhmAllTriggers = _lhmAllTriggers; iun = _jc; lcl = _lcl; hand_cursor = new Cursor( Display.getDefault( ), SWT.CURSOR_HAND ); _gc = new GC( Display.getDefault( ) ); this.iv = iv; }
Example #24
Source File: SWTResourceManager.java From ldparteditor with MIT License | 5 votes |
/** * Dispose all of the cached cursors. */ public static void disposeCursors() { for (Cursor cursor : m_idToCursorMap.values()) { cursor.dispose(); } m_idToCursorMap.clear(); }
Example #25
Source File: ResourceQueryTest.java From swt-bling with MIT License | 5 votes |
@Test public void getResources_Create4Cursors_CountEquals4() { Map<String, Integer> counts = ResourceQuery.getAllocatedResourceCounts(display); for (int i = 0; i < 4; i++) { new Cursor(display, i); } Assert.assertEquals(4, ResourceQuery.getAllocatedResourceCounts(display).get(Cursor.class.getName()).intValue()); }
Example #26
Source File: CopiedOverviewRuler.java From Pydev with Eclipse Public License 1.0 | 5 votes |
/** * Handles mouse moves. * * @param event the mouse move event */ protected void handleMouseMove(MouseEvent event) { if (fTextViewer != null) { int[] lines = toLineNumbers(event.y); Position p = getAnnotationPosition(lines); Cursor cursor = (p != null ? fHitDetectionCursor : null); if (cursor != fLastCursor) { fCanvas.setCursor(cursor); fLastCursor = cursor; } } }
Example #27
Source File: TimeGraphControl.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
private void updateCursor(int x, int stateMask) { // if Wait cursor not active, check for the need to change the cursor if (getCursor() == fWaitCursor) { return; } Cursor cursor = null; if (fDragState == DRAG_SPLIT_LINE) { } else if (fDragState == DRAG_SELECTION) { cursor = fResizeCursor; } else if (fDragState == DRAG_TRACE_ITEM) { cursor = fDragCursor; } else if (fDragState == DRAG_ZOOM) { cursor = fZoomCursor; } else if ((stateMask & SWT.MODIFIER_MASK) == SWT.CTRL) { cursor = fDragCursor; } else if ((stateMask & SWT.MODIFIER_MASK) == SWT.SHIFT) { cursor = fResizeCursor; } else if (!isOverSplitLine(x)) { long selectionBegin = fTimeProvider.getSelectionBegin(); long selectionEnd = fTimeProvider.getSelectionEnd(); int xBegin = getXForTime(selectionBegin); int xEnd = getXForTime(selectionEnd); if (Math.abs(x - xBegin) < SNAP_WIDTH || Math.abs(x - xEnd) < SNAP_WIDTH) { cursor = fResizeCursor; } } if (getCursor() != cursor) { setCursor(cursor); } }
Example #28
Source File: MultipleShapesHorizontalMoveTool.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * if the drag is permitted, show the cursor. * * Else if a drag is occuring show it too, or show the * no cursor. */ protected Cursor getDefaultCursor() { if (isMoveValid()) { return SharedCursors.SIZEWE; } else { if (getState() == STATE_DRAG_IN_PROGRESS) { return SharedCursors.SIZEWE; } return SharedCursors.ARROW; } }
Example #29
Source File: DbTab.java From Rel with Apache License 2.0 | 5 votes |
private void showConversion(String message, String dbURL) { Cursor oldCursor = getParent().getCursor(); getParent().setCursor(new Cursor(getParent().getDisplay(), SWT.CURSOR_WAIT)); try { contentConversion = new DbTabContentConversion(DbTab.this, message, dbURL, modeContent); } finally { getParent().getCursor().dispose(); getParent().setCursor(oldCursor); } contentStack.topControl = contentConversion; modeContent.layout(); }
Example #30
Source File: SWTResourceManager.java From logbook with MIT License | 5 votes |
/** * Dispose all of the cached cursors. */ public static void disposeCursors() { for (Cursor cursor : m_idToCursorMap.values()) { cursor.dispose(); } m_idToCursorMap.clear(); }