Java Code Examples for org.eclipse.swt.SWT#getVersion()

The following examples show how to use org.eclipse.swt.SWT#getVersion() . 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: PaperClips.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Ends a dummy job on the given Printer if the platform requires a dummy
 * job.
 * 
 * @param printer
 *            the Printer hosting the dummy print job.
 */
public static void endDummyJob(Printer printer) {
	if (isGTK()) { // Linux GTK
		// Printer.cancelJob() is not implemented in SWT since GTK has no
		// API for cancelling a print job. For now we must use endJob(),
		// even though it spits out an empty page.

		// printer.cancelJob(); // Not implemented in SWT on GTK
		printer.endJob();

		// See also:
		// http://bugzilla.gnome.org/show_bug.cgi?id=339323
		// https://bugs.eclipse.org/bugs/show_bug.cgi?id=212594
	} else if (isCarbon()) // Mac OSX
		// 2007-04-30: A bug in SWT on Mac OSX prior to 3.3 renders Printer
		// instances useless after a call to cancelJob().
		// Therefore on Mac OSX we call endJob() instead of cancelJob().
		if (SWT.getVersion() < 3346) { // Version 3.3
			printer.endJob();
		} else {
			printer.cancelJob();
		}
}
 
Example 2
Source File: ConfigSectionInterfaceColorSWT.java    From BiglyBT with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void build() {
	setDefaultUITypesForAdd(UIInstance.UIT_SWT);

	if ( Constants.isOSX && SWT.getVersion() >= 4924 ){	// 4.12RC2
		
		add( new BooleanParameterImpl( "Use System Theme", "ConfigView.section.style.usesystemtheme"));
	}

	ColorParameterImpl colorScheme = new ColorParameterImpl("Color Scheme",
			"ConfigView.section.color");
	add(colorScheme);
	colorScheme.setSuffixLabelKey("restart.required.for.some");
	
	List<Parameter> listOverride = new ArrayList<>();

	for (String s : sColorsToOverride) {
		if (Utils.TABLE_GRIDLINE_IS_ALTERNATING_COLOR
				&& s.equals("altRow")) {
			continue;
		}
		String sConfigID = "Colors." + s;
		ColorParameterImpl colorParm = new ColorParameterImpl(sConfigID,
				"ConfigView.section.style.colorOverride." + s);
		add(colorParm, listOverride);
	}

	add(new ParameterGroupImpl("ConfigView.section.style.colorOverrides",
			listOverride));
}
 
Example 3
Source File: UpdateMonitor.java    From BiglyBT with GNU General Public License v2.0 5 votes vote down vote up
protected void performAutoCheck(final boolean start_of_day) {
	boolean check_at_start = false;
	boolean check_periodic = false;
	boolean bOldSWT = SWT.getVersion() < 3139;

	// no update checks for java web start

	if (!SystemProperties.isJavaWebStartInstance()) {

		// force check when SWT is really old
		check_at_start = COConfigurationManager.getBooleanParameter("update.start")
				|| bOldSWT;
		check_periodic = COConfigurationManager.getBooleanParameter("update.periodic");
	}

	// periodic -> check at start as well

	check_at_start = check_at_start || check_periodic;

	if ((check_at_start && start_of_day) || (check_periodic && !start_of_day)) {

		performCheck(bOldSWT, true, false, null ); // this will implicitly do usage stats

	} else {

		new DelayedEvent("UpdateMon:wait2", 5000, new AERunnable() {
			@Override
			public void runSupport() {
				if (start_of_day) {
					UIFunctions uiFunctions = UIFunctionsManager.getUIFunctions();
					if (uiFunctions != null) {
						uiFunctions.setStatusText("");
					}
				}

				CoreUpdateChecker.doUsageStats();
			}
		});
	}
}
 
Example 4
Source File: FXCanvasEx.java    From gef with Eclipse Public License 2.0 5 votes vote down vote up
private void sendScrollEventToFX(EventType<ScrollEvent> eventType,
		double scrollX, double scrollY, int x, int y, int stateMask,
		boolean inertia) {
	// up to and including SWT 4.5, direction was inverted for pan
	// gestures on the Mac
	// (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=481331)
	final double multiplier = ("cocoa".equals(SWT.getPlatform())
			&& SWT.getVersion() < 4600) ? -5.0 : 5.0;

	if (eventType == ScrollEvent.SCROLL_STARTED) {
		totalScrollX = 0;
		totalScrollY = 0;
	} else if (inertia) {
		// inertia events do not belong to the gesture,
		// thus total scroll is not accumulated
		totalScrollX = scrollX;
		totalScrollY = scrollY;
	} else {
		// accumulate total scroll as long as the gesture occurs
		totalScrollX += scrollX;
		totalScrollY += scrollY;
	}

	final Point los = toDisplay(x, y);
	scheduleSceneRunnable(new ISceneRunnable() {
		@Override
		public void run(TKSceneListenerWrapper sceneListener) {
			sceneListener.scrollEvent(eventType, scrollX, scrollY,
					totalScrollX, totalScrollY, multiplier, multiplier,
					0, 0, 0, 0, 0, x, y, los.x, los.y,
					(stateMask & SWT.SHIFT) != 0,
					(stateMask & SWT.CONTROL) != 0,
					(stateMask & SWT.ALT) != 0,
					(stateMask & SWT.COMMAND) != 0, false, inertia);
		}
	});
}
 
Example 5
Source File: TmfAbstractToolTipHandler.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
private static Rectangle getBounds(Shell shell) {
    Rectangle bounds = shell.getBounds();
    if (SWT.getVersion() < 4902 && SWT.getPlatform().equals("gtk")) { //$NON-NLS-1$
        /* Bug 319612 - [Gtk] Shell.getSize() returns wrong value when created with style SWT.RESIZE | SWT.ON_TOP */
        bounds = shell.computeTrim(bounds.x, bounds.y, bounds.width, bounds.height);
    }
    return bounds;
}