Java Code Examples for org.eclipse.swt.graphics.Point

The following are top voted examples for showing how to use org.eclipse.swt.graphics.Point. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: applecommander   File: TextFilterAdapter.java   View source code 6 votes vote down vote up
protected void createTextWidget(String textContents) {
	StyledText styledText = new StyledText(getComposite(), SWT.NONE);
	styledText.setText(textContents);
	styledText.setFont(getCourierFont());
	styledText.setEditable(false);
	//styledText.setWordWrap(true);		// seems to throw size out-of-whack
	Point size = styledText.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
	getComposite().setContent(styledText);
	getComposite().setExpandHorizontal(true);
	getComposite().setExpandVertical(true);
	getComposite().setMinWidth(size.x);
	getComposite().setMinHeight(size.y);
	getComposite().getContent().addListener(SWT.KeyUp, getToolbarCommandHandler());

	getToolItem().setSelection(true);		
	setContentTypeAdapter(new StyledTextAdapter(styledText, getFileEntry().getFilename()));
}
 
Example 2
Project: xcalendar   File: XCalendarTimeWidget.java   View source code 6 votes vote down vote up
/**
 * 
 */
@Override
public void render(XCalendarFrame frame) {
	// Background
	final GC gc = frame.getGc();
	final boolean hovered = mouse.isEntered();
	final XCalendarModel model = popup.getModel();
	final XCalendarTheme theme = model.getTheme();
	final XVirtualCalendar calendar = model.getCalendar();
	int x = bounds.x, y = bounds.y, w = bounds.width, h = bounds.height;
	gc.setBackground(theme.getBackground(true, false, false, hovered));
	gc.fillRoundRectangle(x, y, w, h, theme.getArc(), theme.getArc());

	// Foreground
	String t1 = this.type.text(theme, calendar);
	gc.setForeground(theme.getForeground(true, false, true));
	gc.setFont(theme.getBold()); final Point s1 = extent(gc, t1);
	gc.drawText(t1, x + 1 + ((w - s1.x) >> 1), y + 1 + ((h - s1.y) >> 1));
	
	if(this.type == XCalendarTime.HOUR || this.type == XCalendarTime.MINUTE) {
		String t2 = ":"; Point s2 = extent(gc, t2);
		gc.setBackground(theme.getBackground(true, false, false, false));
		gc.drawText(t2, x + 1 + w + (getMargin().x >> 2), y + 1 + ((h - s2.y) >> 1));
	}
}
 
Example 3
Project: eclipse-batch-editor   File: AbstractFilterableTreeQuickDialog.java   View source code 6 votes vote down vote up
@Override
protected Point getInitialSize() {
	IDialogSettings dialogSettings = getDialogSettings();
	if (dialogSettings == null) {
		/* no dialog settings available, so fall back to min settings */
		return new Point(minWidth, minHeight);
	}
	Point point = super.getInitialSize();
	if (point.x < minWidth) {
		point.x = minWidth;
	}
	if (point.y < minHeight) {
		point.y = minHeight;
	}
	return point;
}
 
Example 4
Project: tap17-muggl-javaee   File: ArrayEntriesWindow.java   View source code 6 votes vote down vote up
/**
 * Create the Shell, setting up any elements that are not set up by the main Composite.
 * @param arrayModificationHandler The ArrayModificationHandler the holds the represented array.
 * @param myDimension The dimension of a probably multidimensional array this Window represents.
 * @param dimensionsIndexes Dimension indexes of the higher-level dimensions the array represented might be a part of.
 */
private void createShell(ArrayModificationHandler arrayModificationHandler, int myDimension, int[] dimensionsIndexes) {
	this.shell = new Shell(this.display, SWT.BORDER | SWT.CLOSE | SWT.TITLE | SWT.MIN);
	this.shell.setText(Globals.WINDOWS_TITLE + Globals.WINDOWS_TITLE_CONNECTOR + "Array Entries");
	this.shell.setLayout(new FillLayout(SWT.VERTICAL));

	// Initialize the composite.
	new ArrayEntriesComposite(this, this.shell, this.display, SWT.NONE, arrayModificationHandler, myDimension, dimensionsIndexes);

	// Compute the needed size.
	Point point = this.shell.computeSize(SWT.DEFAULT, SWT.DEFAULT);
	point.x += 2;
	point.y += 2;
	int[] posXY = StaticGuiSupport.getCenteredPosition(point.x, point.y, this.parent.getShell());
	this.shell.setBounds(posXY[0], posXY[1], point.x, point.y);
}
 
Example 5
Project: neoscada   File: TitleRenderer.java   View source code 6 votes vote down vote up
@Override
public void render ( final Graphics g, final Rectangle clientRectangle )
{
    if ( this.title == null || this.title.isEmpty () )
    {
        return;
    }

    g.setClipping ( this.rect );

    g.setFont ( createFont ( g.getResourceManager () ) );

    final Point size = g.textExtent ( this.title );

    final int x = this.rect.width / 2 - size.x / 2;
    final int y = this.padding;
    g.drawText ( this.title, this.rect.x + x, this.rect.y + y, null );

    g.setClipping ( clientRectangle );
}
 
Example 6
Project: tap17-muggl-javaee   File: ClassInspectionWindow.java   View source code 6 votes vote down vote up
/**
 * Create the Shell, setting up any elements that are not set up by the main Composite.
 * @param parentShell The parent windows' Shell.
 * @param className The name of the class to inspect.
 * @param classFile The ClassFile to inspect.
 */
private void createShell(Shell parentShell, String className, ClassFile classFile) {
	this.shell = new Shell(this.display, SWT.BORDER | SWT.CLOSE | SWT.TITLE | SWT.MIN);
	this.shell.setText(Globals.WINDOWS_TITLE + Globals.WINDOWS_TITLE_CONNECTOR + "Class File Inspection");
	this.shell.setLayout(new FillLayout(SWT.VERTICAL));

	// No need to read it later, so it is not assigned to a variable.
	new ClassInspectionComposite(this, this.shell, this.display, SWT.NONE, className, classFile);

	// Compute the needed size.
	Point point = this.shell.computeSize(SWT.DEFAULT, SWT.DEFAULT);
	point.x += 2;
	point.y += 2;
	int[] posXY = StaticGuiSupport.getCenteredPosition(point.x, point.y, parentShell);
	this.shell.setBounds(posXY[0], posXY[1], point.x, point.y);
}
 
Example 7
Project: SWET   File: BreadcrumbItem.java   View source code 6 votes vote down vote up
private Point computeSizeOfTextAndImages() {
	int width = 0, height = 0;
	final boolean textISNotEmpty = getText() != null && !getText().equals("");

	if (textISNotEmpty) {
		final GC gc = new GC(this.parentBreadcrumb);
		gc.setFont(this.parentBreadcrumb.getFont());
		final Point extent = gc.stringExtent(getText());
		gc.dispose();
		width += extent.x;
		height = extent.y;
	}

	final Point imageSize = computeMaxWidthAndHeightForImages(getImage(),
			this.selectionImage, this.disabledImage);

	if (imageSize.x != -1) {
		width += imageSize.x;
		height = Math.max(imageSize.y, height);
		if (textISNotEmpty) {
			width += MARGIN * 2;
		}
	}
	width += MARGIN;
	return new Point(width, height);
}
 
Example 8
Project: xcalendar   File: XCalendarClearWidget.java   View source code 6 votes vote down vote up
/**
 * Render
 */
@Override
public void render(XCalendarFrame frame) {
	// Background
	final GC gc = frame.getGc();
	final XCalendarModel model = popup.getModel();
	final XCalendarTheme theme = model.getTheme();
	final boolean hovered = this.mouse.isEntered();
	int x = bounds.x, y = bounds.y, w = bounds.width, h = bounds.height;
	gc.setBackground(theme.getBackground(true, false, false, hovered));
	gc.fillRoundRectangle(x, y, w, h, theme.getArc(), theme.getArc());

	// Foreground
	String text = trash_o;
	gc.setForeground(theme.getToolBarBackground(false));
	gc.setFont(Fonts.getAwesomeFont()); final Point size = extent(gc, text);
	gc.drawText(text, x + 1 + ((w - size.x) >> 1), y + 1 + ((h - size.y) >> 1));
}
 
Example 9
Project: tap17-muggl-javaee   File: OptionsWindow.java   View source code 6 votes vote down vote up
/**
 * Create the Shell, setting up any elements that are not set up by the main Composite.
 * @param parentShell The parent windows' Shell.
 * @param classLoader The system MugglClassLoader.
 */
private void createShell(Shell parentShell, MugglClassLoader classLoader) {
	this.shell = new Shell(this.display, SWT.BORDER | SWT.CLOSE | SWT.TITLE | SWT.MIN);
	this.shell.setText(Globals.WINDOWS_TITLE + Globals.WINDOWS_TITLE_CONNECTOR + "Options");
	this.shell.setLayout(new FillLayout(SWT.VERTICAL));
	
	final Image small = new Image(shell.getDisplay(),
	        OptionsWindow.class.getResourceAsStream("/images/tray_small.png"));
	final Image large = new Image(shell.getDisplay(),
			OptionsWindow.class.getResourceAsStream("/images/tray_large.png"));
	this.shell.setImages(new Image[] { small, large });
	
	// No need to read it later, so it is not assigned to a variable.
	new OptionsComposite(this, this.shell, SWT.NONE, classLoader);

	// Compute the needed size.
	Point point = this.shell.computeSize(SWT.DEFAULT, SWT.DEFAULT);
	point.x += 2;
	point.y += 2;
	int[] posXY = StaticGuiSupport.getCenteredPosition(point.x, point.y, parentShell);
	this.shell.setBounds(posXY[0], posXY[1], point.x, point.y);
}
 
Example 10
Project: AppleCommander   File: DiskMapTab.java   View source code 6 votes vote down vote up
/**
 * Handle paint requests for vertical ruler.
 */
protected void paintVerticalRuler(PaintEvent event) {
	// FIXME - not i18n safe!!
	String label = (disk.getBitmapLabels()[0] + "s").toUpperCase(); //$NON-NLS-1$
	if (disk.getBitmapLabels().length == 2) {
		label = (disk.getBitmapLabels()[1] + "s").toUpperCase(); //$NON-NLS-1$
	}
	StringBuffer buf = new StringBuffer();
	for (int i=0; i<label.length(); i++) {
		if (i>0) buf.append("\n"); //$NON-NLS-1$
		buf.append(label.charAt(i));
	}
	label = buf.toString();
	Canvas canvas = (Canvas) event.widget;
	Rectangle area = canvas.getClientArea();
	event.gc.drawLine(area.x + area.width/2, area.y, area.x + area.width/2, area.y + area.height);
	Point size = event.gc.textExtent(label);
	event.gc.drawText(label, area.x + area.width/2 - size.x/2, area.y + area.height/2 - size.y/2);
}
 
Example 11
Project: BiglyBT   File: TabbedEntry.java   View source code 5 votes vote down vote up
@Override
public Image obfuscatedImage(Image image) {
	Rectangle bounds = swtItem == null ? null : swtItem.getBounds();
	if ( bounds != null ){

		boolean isActive = swtItem.getParent().getSelection() == swtItem;
		boolean isHeaderVisible = swtItem.isShowing();

		Point location = Utils.getLocationRelativeToShell(swtItem.getParent());

		bounds.x += location.x;
		bounds.y += location.y;

		Map<String, Object> map = new HashMap<>();
		map.put("image", image);
		map.put("obfuscateTitle", false);
		if (isActive) {
			triggerEvent(UISWTViewEvent.TYPE_OBFUSCATE, map);

			if (viewTitleInfo instanceof ObfuscateImage) {
				((ObfuscateImage) viewTitleInfo).obfuscatedImage(image);
			}
		}

		if (isHeaderVisible) {
 			if (viewTitleInfo instanceof ObfuscateTab) {
 				String header = ((ObfuscateTab) viewTitleInfo).getObfuscatedHeader();
 				if (header != null) {
 					UIDebugGenerator.obfuscateArea(image, bounds, header);
 				}
 			}

 			if (MapUtils.getMapBoolean(map, "obfuscateTitle", false)) {
 				UIDebugGenerator.obfuscateArea(image, bounds);
 			}
		}
	}

	return image;
}
 
Example 12
Project: Hydrograph   File: PaletteToolTip.java   View source code 5 votes vote down vote up
/**
 * 
 * Returns tooltip bounds
 * 
 * @return org.eclipse.swt.graphics.Rectangle
 */
public Rectangle getToolTipBounds(){
	Point tooltipSize = getToolTipWidthHeight();
	Rectangle bounds = new Rectangle(0, 0, tooltipSize.x, tooltipSize.y);
	logger.debug("tooltip bounds=" + bounds);
	return bounds;
}
 
Example 13
Project: time4sys   File: SrmEditor.java   View source code 5 votes vote down vote up
/**
 * If there is just one page in the multi-page editor part,
 * this hides the single tab at the bottom.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void hideTabs() {
	if (getPageCount() <= 1) {
		setPageText(0, "");
		if (getContainer() instanceof CTabFolder) {
			((CTabFolder)getContainer()).setTabHeight(1);
			Point point = getContainer().getSize();
			getContainer().setSize(point.x, point.y + 6);
		}
	}
}
 
Example 14
Project: eclipse-bash-editor   File: BashBracketsSupport.java   View source code 5 votes vote down vote up
protected final IRegion getSignedSelection(ISourceViewer sourceViewer) {
	Point viewerSelection = sourceViewer.getSelectedRange();

	StyledText text = sourceViewer.getTextWidget();
	Point selection = text.getSelectionRange();
	if (text.getCaretOffset() == selection.x) {
		viewerSelection.x = viewerSelection.x + viewerSelection.y;
		viewerSelection.y = -viewerSelection.y;
	}

	return new Region(viewerSelection.x, viewerSelection.y);
}
 
Example 15
Project: BiglyBT   File: ShellFactory.java   View source code 5 votes vote down vote up
@Override
public Point computeSize(int wHint, int hHint) {
	if (!inSetSize && wHint > 0 && hHint == SWT.DEFAULT) {
		inSetSize = true;
		return super.computeSize(Utils.adjustPXForDPI(wHint), hHint);
	}
	return super.computeSize(wHint, hHint);
}
 
Example 16
Project: time4sys   File: NfpEditor.java   View source code 5 votes vote down vote up
/**
 * If there is more than one page in the multi-page editor part,
 * this shows the tabs at the bottom.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void showTabs() {
	if (getPageCount() > 1) {
		setPageText(0, getString("_UI_SelectionPage_label"));
		if (getContainer() instanceof CTabFolder) {
			((CTabFolder)getContainer()).setTabHeight(SWT.DEFAULT);
			Point point = getContainer().getSize();
			getContainer().setSize(point.x, point.y - 6);
		}
	}
}
 
Example 17
Project: xcalendar   File: XCalendarMonthWidget.java   View source code 5 votes vote down vote up
/**
 * 
 */
@Override
public void render(XCalendarFrame frame) {
	// Background
	final GC gc = frame.getGc();
	final boolean hovered = mouse.isEntered();
	final XCalendarModel model = popup.getModel();
	final XCalendarTheme theme = model.getTheme();
	final XVirtualCalendar calendar = model.getCalendar();
	
	ZoneId zoneId = model.getZoneId();
	final int year = calendar.getYear();
	final int month = query(calendar, zoneId, col, row);
	final ZonedDateTime d2 = calendar.getTravelDateTime();
	final ZonedDateTime d1 = calendar.getCalendarDateTime();
	boolean selected = isSameYear(d1, d2) && month == d1.getMonthValue();
	this.enabled = isValidYearMonth(year, month, zoneId, calendar::isValid);
	int x = bounds.x, y = bounds.y, w = bounds.width, h = bounds.height;
	gc.setBackground(theme.getBackground(enabled, selected, false, hovered));
	gc.fillRoundRectangle(x, y, w, h, theme.getArc(), theme.getArc());
	
	// Foreground
	String text = theme.getMonthTheme()[row][col];
	gc.setForeground(theme.getForeground(enabled, selected, true));
	gc.setFont(theme.getFont()); final Point size = extent(gc, text);
	gc.drawText(text, x + 1 + ((w - size.x) >> 1), y + 1 + ((h - size.y) >> 1));
}
 
Example 18
Project: OCCI-Studio   File: PlatformEditor.java   View source code 5 votes vote down vote up
/**
 * If there is just one page in the multi-page editor part,
 * this hides the single tab at the bottom.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void hideTabs() {
	if (getPageCount() <= 1) {
		setPageText(0, "");
		if (getContainer() instanceof CTabFolder) {
			((CTabFolder)getContainer()).setTabHeight(1);
			Point point = getContainer().getSize();
			getContainer().setSize(point.x, point.y + 6);
		}
	}
}
 
Example 19
Project: n4js   File: ShowHistoryAction.java   View source code 5 votes vote down vote up
@Override
public void runWithEvent(Event event) {
	if (event.widget instanceof ToolItem) {
		final ToolItem toolItem = (ToolItem) event.widget;
		final Control control = toolItem.getParent();
		final Menu menu = getMenuCreator().getMenu(control);

		final Rectangle bounds = toolItem.getBounds();
		final Point topLeft = new Point(bounds.x, bounds.y + bounds.height);
		menu.setLocation(control.toDisplay(topLeft));
		menu.setVisible(true);
	}
}
 
Example 20
Project: n4js   File: N4JSApplicationWorkbenchWindowAdvisor.java   View source code 5 votes vote down vote up
@Override
public void preWindowOpen() {
	super.preWindowOpen();
	final IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
	configurer.setInitialSize(new Point(1024, 768));
	configurer.setShowCoolBar(true);
	configurer.setShowStatusLine(true);
	configurer.setShowProgressIndicator(true);
	configurer.setShowPerspectiveBar(true);
	initN4Context();
	updateDefaultEditorMappingIfAbsent();
	reviewDisabledCategoriesFromAppModel();

}
 
Example 21
Project: gemoc-studio   File: FsmEditor.java   View source code 5 votes vote down vote up
/**
 * If there is just one page in the multi-page editor part,
 * this hides the single tab at the bottom.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void hideTabs() {
	if (getPageCount() <= 1) {
		setPageText(0, "");
		if (getContainer() instanceof CTabFolder) {
			((CTabFolder)getContainer()).setTabHeight(1);
			Point point = getContainer().getSize();
			getContainer().setSize(point.x, point.y + 6);
		}
	}
}
 
Example 22
Project: convertigo-eclipse   File: KTable.java   View source code 5 votes vote down vote up
/**
 * Returns true, if the given cell is selected. Works also in Row Selection
 * Mode.
 * 
 * @param col
 * @param row
 * @return boolean
 */
public boolean isCellSelected(int col, int row) {
  if (!m_MultiSelectMode) {
    if (m_RowSelectionMode)
      return (row == m_FocusRow);
    return (col == m_FocusCol && row == m_FocusRow);
  }

  if (m_RowSelectionMode)
    return (m_Selection.get(new Integer(row)) != null);
  else
    return (m_Selection.get(new Point(col, row)) != null);
}
 
Example 23
Project: convertigo-eclipse   File: SequenceComposite.java   View source code 5 votes vote down vote up
protected void initialize() {
	GridData gridData = new org.eclipse.swt.layout.GridData();
	gridData.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
	gridData.grabExcessHorizontalSpace = true;
	gridData.grabExcessVerticalSpace = true;
	gridData.verticalAlignment = org.eclipse.swt.layout.GridData.FILL;
	httpData = new Text(this, SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
	httpData.setLayoutData(gridData);
	httpData.setText("");
	this.setLayout(new GridLayout());
	setSize(new Point(300, 200));
}
 
Example 24
Project: SWET   File: PopupDialog.java   View source code 5 votes vote down vote up
/**
 * Saves the bounds of the shell in the appropriate dialog settings. The
 * bounds are recorded relative to the parent shell, if there is one, or
 * display coordinates if there is no parent shell. Subclasses typically
 * need not override this method, but may extend it (calling
 * <code>super.saveDialogBounds</code> if additional bounds information
 * should be stored. Clients may also call this method to persist the bounds
 * at times other than closing the dialog.
 * 
 * @param shell
 *            The shell whose bounds are to be stored
 */
protected void saveDialogBounds(Shell shell) {
	IDialogSettings settings = getDialogSettings();
	if (settings != null) {
		Point shellLocation = shell.getLocation();
		Point shellSize = shell.getSize();
		Shell parent = getParentShell();
		if (parent != null) {
			Point parentLocation = parent.getLocation();
			shellLocation.x -= parentLocation.x;
			shellLocation.y -= parentLocation.y;
		}
		String prefix = getClass().getName();
		if (persistSize) {
			settings.put(prefix + DIALOG_WIDTH, shellSize.x);
			settings.put(prefix + DIALOG_HEIGHT, shellSize.y);
		}
		if (persistLocation) {
			settings.put(prefix + DIALOG_ORIGIN_X, shellLocation.x);
			settings.put(prefix + DIALOG_ORIGIN_Y, shellLocation.y);
		}
		if (showPersistActions && showDialogMenu) {
			settings.put(getClass().getName() + DIALOG_USE_PERSISTED_SIZE,
					persistSize);
			settings.put(getClass().getName() + DIALOG_USE_PERSISTED_LOCATION,
					persistLocation);

		}
	}
}
 
Example 25
Project: Hydrograph   File: ComponentSearchUtility.java   View source code 5 votes vote down vote up
/**
 * Calculate the cursor position on current editor
 * @return cursorRelativePosition
 */
private Point calculatePosition() {

	Point cursorAbsLocation = graphicControl.getDisplay().getCursorLocation();
	Point cursorRelativePosition = graphicControl.getDisplay().map(null, graphicControl, cursorAbsLocation);
	if (!isInsideGraphic(cursorRelativePosition, graphicControl.getSize())) {
		return null;
	}
	return cursorRelativePosition;
}
 
Example 26
Project: iTrace-Archive   File: ITrace.java   View source code 5 votes vote down vote up
/**
 * Finds the control under the specified screen coordinates and calls its
 * gaze handler on the localized point. Returns the gaze response or null if
 * the gaze is not handled.
 */
private IGazeResponse handleGaze(int screenX, int screenY, Gaze gaze){
	Queue<Control[]> childrenQueue = new LinkedList<Control[]>();
	childrenQueue.add(rootShell.getChildren());
	Rectangle monitorBounds = rootShell.getMonitor().getBounds();
    while (!childrenQueue.isEmpty()) {
        for (Control child : childrenQueue.remove()) {
            Rectangle childScreenBounds = child.getBounds();
            Point screenPos = child.toDisplay(0, 0);
            childScreenBounds.x = screenPos.x - monitorBounds.x;
            childScreenBounds.y = screenPos.y - monitorBounds.y;
            if (childScreenBounds.contains(screenX, screenY)) {
                if (child instanceof Composite) {
                    Control[] nextChildren =
                            ((Composite) child).getChildren();
                    if (nextChildren.length > 0 && nextChildren[0] != null) {
                        childrenQueue.add(nextChildren);
                    }
                }
                IGazeHandler handler =
                        (IGazeHandler) child
                                .getData(HandlerBindManager.KEY_HANDLER);
                if (child.isVisible() && handler != null) {
                    return handler.handleGaze(screenX, screenY,
                            screenX - childScreenBounds.x, screenY
                                    - childScreenBounds.y, gaze);
                }
            }
        }
    }
    return null;
}
 
Example 27
Project: gemoc-studio-modeldebugging   File: DecoratingColumLabelProvider.java   View source code 5 votes vote down vote up
@Override
public Point getToolTipShift(Object element) {
	final Point res;

	if (cellLabelProvider == null) {
		res = null;
	} else {
		res = cellLabelProvider.getToolTipShift(element);
	}

	return res;
}
 
Example 28
Project: gemoc-studio-modeldebugging   File: TracingannotationsEditor.java   View source code 5 votes vote down vote up
/**
 * If there is just one page in the multi-page editor part,
 * this hides the single tab at the bottom.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void hideTabs() {
	if (getPageCount() <= 1) {
		setPageText(0, "");
		if (getContainer() instanceof CTabFolder) {
			((CTabFolder)getContainer()).setTabHeight(1);
			Point point = getContainer().getSize();
			getContainer().setSize(point.x, point.y + 6);
		}
	}
}
 
Example 29
Project: BiglyBT   File: SideBarToolTips.java   View source code 5 votes vote down vote up
/**
 * @return
 *
 * @since 3.1.1.1
 */
private String getToolTip(Point mousePos_RelativeToItem) {
	MdiEntryVitalityImage[] vitalityImages = mdiEntry.getVitalityImages();
	for (int i = 0; i < vitalityImages.length; i++) {
		SideBarVitalityImageSWT vitalityImage = (SideBarVitalityImageSWT) vitalityImages[i];
		if (vitalityImage == null) {
			continue;
		}
		String indicatorToolTip = vitalityImage.getToolTip();
		if (indicatorToolTip == null || !vitalityImage.isVisible()) {
			continue;
		}
		Rectangle hitArea = vitalityImage.getHitArea();
		if (hitArea == null) {
			continue;
		}
		if (hitArea.contains(mousePos_RelativeToItem)) {
			return indicatorToolTip;
		}
	}

	if (mdiEntry.getViewTitleInfo() != null) {
		String tt = (String) mdiEntry.getViewTitleInfo().getTitleInfoProperty(ViewTitleInfo.TITLE_INDICATOR_TEXT_TOOLTIP);
		return tt;
	}

	return null;
}
 
Example 30
Project: Hydrograph   File: ComponentSearchUtility.java   View source code 5 votes vote down vote up
private void createAssitTextBox(Point cursorRelativePosition) {
	assistText = new Text((Composite) graphicControl, SWT.BORDER);
	assistText.setLocation(cursorRelativePosition.x, cursorRelativePosition.y - assistText.getLineHeight());
	assistText.setSize(200, assistText.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
	assistText.setTextLimit(51);
	assistText.setFocus();
}
 
Example 31
Project: xcalendar   File: XCalendarMonthWidget.java   View source code 5 votes vote down vote up
/**
 * 
 */
@Override
public Pair<Point> locate(int x, int y, int w, int m) {
	int unit = w / 4;
	if(col == 3) { x = m; y += unit; } else { x += unit; }
	return new Pair<>(new Point(unit, unit), new Point(x, y));
}
 
Example 32
Project: Hydrograph   File: CommentBoxFigure.java   View source code 5 votes vote down vote up
/**
 * 
 * Computes location of comment box figure relative to workbench
 * 
 * @param figureMouseLocation
 * @return
 */
private Point getFigureLocationOnWorkbench(Point figureMouseLocation) {

	int subtractFromMouseX, addToMouseY;
	java.awt.Point workbenchAWTMouseLocation = MouseInfo.getPointerInfo().getLocation();
	Point workbenchMouseLocation = new Point(workbenchAWTMouseLocation.x, workbenchAWTMouseLocation.y);

	subtractFromMouseX = figureMouseLocation.x - getBounds().x;
	addToMouseY = getBounds().y - figureMouseLocation.y;

	return new org.eclipse.swt.graphics.Point((workbenchMouseLocation.x - subtractFromMouseX),
			(workbenchMouseLocation.y + addToMouseY));
}
 
Example 33
Project: time4sys   File: TraceEditor.java   View source code 5 votes vote down vote up
/**
 * If there is just one page in the multi-page editor part,
 * this hides the single tab at the bottom.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void hideTabs() {
	if (getPageCount() <= 1) {
		setPageText(0, "");
		if (getContainer() instanceof CTabFolder) {
			((CTabFolder)getContainer()).setTabHeight(1);
			Point point = getContainer().getSize();
			getContainer().setSize(point.x, point.y + 6);
		}
	}
}
 
Example 34
Project: pmTrans   File: FindReplaceDialog.java   View source code 5 votes vote down vote up
private boolean replace() {
	Point x = text.getSelection();
	if (!text.getSelectionText().isEmpty()) {
		text.replaceTextRange(text.getSelection().x, text.getSelection().y - text.getSelection().x,
				replaceText.getText());
		text.setSelection(x.x + replaceText.getText().length());
		return true;
	}
	return false;
}
 
Example 35
Project: time4sys   File: GrmEditor.java   View source code 5 votes vote down vote up
/**
 * If there is just one page in the multi-page editor part,
 * this hides the single tab at the bottom.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void hideTabs() {
	if (getPageCount() <= 1) {
		setPageText(0, "");
		if (getContainer() instanceof CTabFolder) {
			((CTabFolder)getContainer()).setTabHeight(1);
			Point point = getContainer().getSize();
			getContainer().setSize(point.x, point.y + 6);
		}
	}
}
 
Example 36
Project: time4sys   File: DesignEditor.java   View source code 5 votes vote down vote up
/**
 * If there is just one page in the multi-page editor part,
 * this hides the single tab at the bottom.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void hideTabs() {
	if (getPageCount() <= 1) {
		setPageText(0, "");
		if (getContainer() instanceof CTabFolder) {
			((CTabFolder)getContainer()).setTabHeight(1);
			Point point = getContainer().getSize();
			getContainer().setSize(point.x, point.y + 6);
		}
	}
}
 
Example 37
Project: gemoc-studio   File: GexpressionsEditor.java   View source code 5 votes vote down vote up
/**
 * If there is more than one page in the multi-page editor part,
 * this shows the tabs at the bottom.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void showTabs() {
	if (getPageCount() > 1) {
		setPageText(0, getString("_UI_SelectionPage_label"));
		if (getContainer() instanceof CTabFolder) {
			((CTabFolder)getContainer()).setTabHeight(SWT.DEFAULT);
			Point point = getContainer().getSize();
			getContainer().setSize(point.x, point.y - 6);
		}
	}
}
 
Example 38
Project: iTrace-Archive   File: TokenHighlighter.java   View source code 5 votes vote down vote up
public TokenHighlighter(StyledText styledText, boolean show, ProjectionViewer projviewer){
	this.styledText = styledText;
	this.projviewer = projviewer;
	this.styledText.addPaintListener(this);
	this.show = show;
	this.numberOfPoints = 1;
	this.points = new Point[numberOfPoints];
	this.pointIndex = 0;
	this.nulls = 0;
	this.eventBroker = PlatformUI.getWorkbench().getService(IEventBroker.class);
	this.eventBroker.subscribe("iTrace/newstresponse", this);
	//this.gazeQueue = Activator.getDefault().gazeTransport.createClient();
	//System.out.println("gazeQueue");
}
 
Example 39
Project: neoscada   File: DetailViewEditor.java   View source code 5 votes vote down vote up
/**
 * If there is just one page in the multi-page editor part,
 * this hides the single tab at the bottom.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void hideTabs ()
{
    if ( getPageCount () <= 1 )
    {
        setPageText ( 0, "" ); //$NON-NLS-1$
        if ( getContainer () instanceof CTabFolder )
        {
            ( (CTabFolder)getContainer () ).setTabHeight ( 1 );
            Point point = getContainer ().getSize ();
            getContainer ().setSize ( point.x, point.y + 6 );
        }
    }
}
 
Example 40
Project: time4sys   File: LibraryEditor.java   View source code 5 votes vote down vote up
/**
 * If there is more than one page in the multi-page editor part,
 * this shows the tabs at the bottom.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void showTabs() {
	if (getPageCount() > 1) {
		setPageText(0, getString("_UI_SelectionPage_label"));
		if (getContainer() instanceof CTabFolder) {
			((CTabFolder)getContainer()).setTabHeight(SWT.DEFAULT);
			Point point = getContainer().getSize();
			getContainer().setSize(point.x, point.y - 6);
		}
	}
}