There are 44 code examples for org.eclipse.swt.graphics.Point.

The API names are highlighted below. You can use suckoo button to vote the code example(s) you like. The best code example will be ranked first next time. Thanks a lot for your feedback.

Project Name: OpenII Package: org.mitre.openii.editors.vocabulary

Source Code: VocabViewCanvas.java (Click to view .java file)

Method Code:
vote
like

/** 
 * displays the search results table in the search vocabulary dialog box 
 */
private void displaySearchResults(Table tableForSearchResults,String searchTerm){
  TableItem[] allRows=tableForSearchResults.getItems();
  for (int i=0; i < allRows.length; i++) {
    allRows[i].dispose();
  }
  Pattern pattern=Pattern.compile("(?i)" + searchTerm);
  TableItem[] allVocabRows=table.getItems();
  for (Integer i=0; i < allVocabRows.length; i++) {
    for (int j=0; j < table.getColumnCount(); j++) {
      String vocabCellText=allVocabRows[i].getText(j);
      Matcher matcher=pattern.matcher(vocabCellText);
      if (matcher.find()) {
        TableItem tempI=new TableItem(tableForSearchResults,SWT.NONE);
        tempI.setText(0,allVocabRows[i].getText(0));
        tempI.setText(1,table.getColumn(j).getText());
        tempI.setText(2,vocabCellText);
        tempI.setImage(2,allVocabRows[i].getImage(j));
        Point location=new Point(i,j);
        tempI.setData(location);
      }
    }
  }
}
 

Project Name: codecover Package: org.codecover.eclipse.views

Source Code: CoverageGraphLayout.java (Click to view .java file)

Method Code:
vote
like

public CoverageGraphLayout(Graph<V,E> g,org.eclipse.swt.graphics.Point size){
  super(g);
  this.size=size;
  this.setSize(new Dimension(size.x,size.y));
}
 

Project Name: codecover Package: org.codecover.eclipse.views

Source Code: CoverageGraphView.java (Click to view .java file)

Method Code:
vote
like

public void propertyChange(PropertyChangeEvent event){
  org.eclipse.swt.graphics.Point size=graphComposite.getSize();
  graphComposite.dispose();
  graphComposite.setLayout(new GridLayout(2,false));
  graphComposite.setLayout(new FillLayout());
}
 

Project Name: codecover Package: org.codecover.eclipse.views

Source Code: RedundancyGraphView.java (Click to view .java file)

Method Code:
vote
like

private final void onChooseMetric(String Criterion){
  org.eclipse.swt.graphics.Point size=this.graphComposite.getSize();
  this.graphComposite.dispose();
  this.graphComposite=new GraphComposite(this.sashForm,SWT.NONE,size,null,"");
  this.graphComposite.setLayout(new GridLayout(2,false));
  this.graphComposite.setLayout(new FillLayout());
  this.graphComposite.setSize(size);
  this.graphComposite.setRedraw(true);
  this.SuiteRedundancy.clear();
  this.PairRedundancy.clear();
  this.ActiveCriterion=Criterion;
  calculateSuiteRedundancy(this.ActiveCriterion);
  calculatePairRedundancy(this.ActiveCriterion);
}
 

Project Name: rssowl.ui Package: org.rssowl.ui.internal

Source Code: Perspective.java (Click to view .java file)

Method Code:
vote
like

private float getRatio(){
  Point size=OwlUI.getFirstMonitorSize();
  if (size != null && size.y != 0) {
    float screenRatio=(float)size.x / (float)size.y;
    return screenRatio > 1.5 ? WIDE_SCREEN_RATIO : NORMAL_SCREEN_RATIO;
  }
  return NORMAL_SCREEN_RATIO;
}
 

Project Name: rssowl.ui Package: org.rssowl.ui.internal

Source Code: ApplicationWorkbenchWindowAdvisor.java (Click to view .java file)

Method Code:
vote
like

@Override public void preWindowOpen(){
  IWorkbenchWindowConfigurer configurer=getWindowConfigurer();
  configurer.setShowCoolBar(true);
  configurer.setShowPerspectiveBar(false);
  configurer.setShowStatusLine(true);
  configurer.setShowMenuBar(true);
  configurer.setShowFastViewBars(false);
  configurer.setShowProgressIndicator(true);
  configurer.setTitle("RSSOwl");
  Point size=OwlUI.getFirstMonitorSize();
  if (size != null)   configurer.setInitialSize(size);
  configurer.addEditorAreaTransfer(LocalSelectionTransfer.getTransfer());
  configurer.configureEditorAreaDropListener(new EditorDNDImpl());
  fPreferences=Owl.getPreferenceService().getGlobalScope();
}
 

Project Name: rssowl.ui Package: org.rssowl.ui.internal

Source Code: OwlUI.java (Click to view .java file)

Method Code:
vote
like

/** 
 * @param action the dropdown action.
 * @param manager the toolbar containing the action.
 */
public static void positionDropDownMenu(Action action,ToolBarManager manager){
  Menu menu=action.getMenuCreator().getMenu(manager.getControl());
  if (menu != null) {
    IContributionItem contributionItem=manager.find(action.getId());
    if (contributionItem != null && contributionItem instanceof ActionContributionItem) {
      Widget widget=((ActionContributionItem)contributionItem).getWidget();
      if (widget != null && widget instanceof ToolItem) {
        ToolItem item=(ToolItem)widget;
        Rectangle rect=item.getBounds();
        Point pt=new Point(rect.x,rect.y + rect.height);
        pt=manager.getControl().toDisplay(pt);
        if (Application.IS_MAC)         pt.y+=5;
        menu.setLocation(pt.x,pt.y);
      }
    }
    menu.setVisible(true);
  }
}
 

Project Name: rssowl.ui Package: org.rssowl.ui.internal.actions

Source Code: NewFolderAction.java (Click to view .java file)

Method Code:
vote
like

@Override protected void initializeBounds(){
  super.initializeBounds();
  Point bestSize=getShell().computeSize(convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH),SWT.DEFAULT);
  getShell().setSize(bestSize.x,bestSize.y);
  LayoutUtils.positionShell(getShell());
}
 

Project Name: rssowl.ui Package: org.rssowl.ui.internal.actions

Source Code: NewNewsBinAction.java (Click to view .java file)

Method Code:
vote
like

@Override protected void initializeBounds(){
  super.initializeBounds();
  Point bestSize=getShell().computeSize(convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH),SWT.DEFAULT);
  getShell().setSize(bestSize.x,bestSize.y);
  LayoutUtils.positionShell(getShell());
}
 

Project Name: rssowl.ui Package: org.rssowl.ui.internal.dialogs

Source Code: UpdateDialog.java (Click to view .java file)

Method Code:
vote
like

@Override protected void initializeBounds(){
  super.initializeBounds();
  Shell shell=getShell();
  int minWidth=convertHorizontalDLUsToPixels(OwlUI.MIN_DIALOG_WIDTH_DLU);
  int minHeight=shell.computeSize(minWidth,SWT.DEFAULT).y;
  Point requiredSize=shell.computeSize(SWT.DEFAULT,SWT.DEFAULT);
  shell.setSize(Math.max(minWidth,requiredSize.x),Math.max(minHeight,requiredSize.y));
  LayoutUtils.positionShell(shell);
}
 

Project Name: rssowl.ui Package: org.rssowl.ui.internal.dialogs

Source Code: MasterPasswordDialog.java (Click to view .java file)

Method Code:
vote
like

@Override protected void initializeBounds(){
  super.initializeBounds();
  Shell shell=getShell();
  int minWidth=convertHorizontalDLUsToPixels(OwlUI.MIN_DIALOG_WIDTH_DLU);
  int minHeight=shell.computeSize(minWidth,SWT.DEFAULT).y;
  Point requiredSize=shell.computeSize(SWT.DEFAULT,SWT.DEFAULT);
  shell.setSize(Math.max(minWidth,requiredSize.x),Math.max(minHeight,requiredSize.y));
  LayoutUtils.positionShell(shell);
}
 

Project Name: rssowl.ui Package: org.rssowl.ui.internal.dialogs

Source Code: LabelDialog.java (Click to view .java file)

Method Code:
vote
like

@Override protected Point getInitialSize(){
  Point shellSize=super.getInitialSize();
  return new Point(Math.max(convertHorizontalDLUsToPixels(MIN_DIALOG_WIDTH),shellSize.x),shellSize.y);
}
 

Project Name: rssowl.ui Package: org.rssowl.ui.internal.dialogs

Source Code: FatalOutOfMemoryErrorDialog.java (Click to view .java file)

Method Code:
vote
like

@Override protected void initializeBounds(){
  super.initializeBounds();
  Point bestSize=getShell().computeSize(convertHorizontalDLUsToPixels(OwlUI.MIN_DIALOG_WIDTH_DLU),SWT.DEFAULT);
  Point location=getInitialLocation(bestSize);
  getShell().setBounds(location.x,location.y,bestSize.x,bestSize.y);
}
 

Project Name: rssowl.ui Package: org.rssowl.ui.internal.dialogs

Source Code: LoginDialog.java (Click to view .java file)

Method Code:
vote
like

@Override protected void initializeBounds(){
  super.initializeBounds();
  Shell shell=getShell();
  int minWidth=convertHorizontalDLUsToPixels(OwlUI.MIN_DIALOG_WIDTH_DLU);
  int minHeight=shell.computeSize(minWidth,SWT.DEFAULT).y;
  Point requiredSize=shell.computeSize(SWT.DEFAULT,SWT.DEFAULT);
  shell.setSize(Math.max(minWidth,requiredSize.x),Math.max(minHeight,requiredSize.y));
  LayoutUtils.positionShell(shell);
}
 

Project Name: rssowl.ui Package: org.rssowl.ui.internal.dialogs

Source Code: AddCredentialsDialog.java (Click to view .java file)

Method Code:
vote
like

@Override protected void initializeBounds(){
  super.initializeBounds();
  Shell shell=getShell();
  int minWidth=convertHorizontalDLUsToPixels(OwlUI.MIN_DIALOG_WIDTH_DLU);
  int minHeight=shell.computeSize(minWidth,SWT.DEFAULT).y;
  Point requiredSize=shell.computeSize(SWT.DEFAULT,SWT.DEFAULT);
  shell.setSize(Math.max(minWidth,requiredSize.x),Math.max(minHeight,requiredSize.y));
  LayoutUtils.positionShell(shell);
}
 

Project Name: rssowl.ui Package: org.rssowl.ui.internal.dialogs

Source Code: StartupProgressDialog.java (Click to view .java file)

Method Code:
vote
like

@Override protected Point getInitialLocation(Point initialSize){
  Rectangle displayBounds=Display.getDefault().getPrimaryMonitor().getBounds();
  Point shellSize=getInitialSize();
  int x=displayBounds.x + (displayBounds.width - shellSize.x) >> 1;
  int y=displayBounds.y + (displayBounds.height - shellSize.y) >> 1;
  return new Point(x,y);
}
 

Project Name: rssowl.ui Package: org.rssowl.ui.internal.dialogs

Source Code: WebsiteListDialog.java (Click to view .java file)

Method Code:
vote
like

@Override protected void initializeBounds(){
  super.initializeBounds();
  Shell shell=getShell();
  int minWidth=convertHorizontalDLUsToPixels(OwlUI.MIN_DIALOG_WIDTH_DLU);
  int minHeight=shell.computeSize(minWidth,SWT.DEFAULT).y;
  Point requiredSize=shell.computeSize(SWT.DEFAULT,SWT.DEFAULT);
  shell.setSize(Math.max(minWidth,requiredSize.x),Math.max(minHeight,requiredSize.y));
  LayoutUtils.positionShell(shell);
}
 

Project Name: rssowl.ui Package: org.rssowl.ui.internal.dialogs

Source Code: ActivityDialog.java (Click to view .java file)

Method Code:
vote
like

@Override protected void initializeBounds(){
  super.initializeBounds();
  if (fFirstTimeOpen) {
    Shell shell=getShell();
    int minWidth=convertHorizontalDLUsToPixels(OwlUI.MIN_DIALOG_WIDTH_DLU);
    int minHeight=convertVerticalDLUsToPixels(MIN_DIALOG_HEIGHT_DLU);
    Point requiredSize=shell.computeSize(SWT.DEFAULT,SWT.DEFAULT);
    shell.setSize(Math.max(minWidth,requiredSize.x),Math.max(minHeight,requiredSize.y));
    LayoutUtils.positionShell(shell);
  }
}
 

Project Name: rssowl.ui Package: org.rssowl.ui.internal.dialogs

Source Code: SynchronizationStatusDialog.java (Click to view .java file)

Method Code:
vote
like

@Override protected void initializeBounds(){
  super.initializeBounds();
  Point bestSize=getShell().computeSize(convertHorizontalDLUsToPixels(OwlUI.MIN_DIALOG_WIDTH_DLU),SWT.DEFAULT);
  Point location=getInitialLocation(bestSize);
  getShell().setBounds(location.x,location.y,bestSize.x,bestSize.y);
}
 

Project Name: rssowl.ui Package: org.rssowl.ui.internal.dialogs

Source Code: ConfirmDialog.java (Click to view .java file)

Method Code:
vote
like

@Override protected void initializeBounds(){
  super.initializeBounds();
  Point bestSize=getShell().computeSize(convertHorizontalDLUsToPixels(OwlUI.MIN_DIALOG_WIDTH_DLU),SWT.DEFAULT);
  Point location=getInitialLocation(bestSize);
  getShell().setBounds(location.x,location.y,bestSize.x,bestSize.y);
}
 

Project Name: rssowl.ui Package: org.rssowl.ui.internal.dialogs

Source Code: ManageSetsDialog.java (Click to view .java file)

Method Code:
vote
like

@Override protected void initializeBounds(){
  super.initializeBounds();
  Shell shell=getShell();
  int minWidth=convertHorizontalDLUsToPixels(OwlUI.MIN_DIALOG_WIDTH_DLU);
  int minHeight=shell.computeSize(minWidth,SWT.DEFAULT).y;
  Point requiredSize=shell.computeSize(SWT.DEFAULT,SWT.DEFAULT);
  shell.setSize(Math.max(minWidth,requiredSize.x),Math.max(minHeight,requiredSize.y));
  LayoutUtils.positionShell(shell);
}
 

Project Name: rssowl.ui Package: org.rssowl.ui.internal.dialogs

Source Code: CustomizeToolbarDialog.java (Click to view .java file)

Method Code:
vote
like

@Override protected void initializeBounds(){
  super.initializeBounds();
  if (fFirstTimeOpen) {
    Shell shell=getShell();
    int minWidth=convertHorizontalDLUsToPixels(OwlUI.MIN_DIALOG_WIDTH_DLU);
    int minHeight=shell.computeSize(minWidth,SWT.DEFAULT).y;
    Point requiredSize=shell.computeSize(SWT.DEFAULT,SWT.DEFAULT);
    shell.setSize(Math.max(minWidth,requiredSize.x),Math.max(minHeight,requiredSize.y));
    LayoutUtils.positionShell(shell);
  }
}
 

Project Name: rssowl.ui Package: org.rssowl.ui.internal.dialogs

Source Code: ArchiveNewsDialog.java (Click to view .java file)

Method Code:
vote
like

@Override protected void initializeBounds(){
  super.initializeBounds();
  Point bestSize=getShell().computeSize(convertHorizontalDLUsToPixels(OwlUI.MIN_DIALOG_WIDTH_DLU),SWT.DEFAULT);
  Point location=getInitialLocation(bestSize);
  getShell().setBounds(location.x,location.y,bestSize.x,bestSize.y);
}
 

Project Name: rssowl.ui Package: org.rssowl.ui.internal.dialogs

Source Code: SearchNewsDialog.java (Click to view .java file)

Method Code:
vote
like

private boolean isInImageBounds(TableItem item,NewsColumn column,Point p){
  int index=indexOf(column);
  if (index == -1)   return false;
  return item.getImageBounds(index).contains(p);
}
 

Project Name: rssowl.ui Package: org.rssowl.ui.internal.dialogs

Source Code: AssignLabelsDialog.java (Click to view .java file)

Method Code:
vote
like

@Override protected void initializeBounds(){
  super.initializeBounds();
  Shell shell=getShell();
  int minWidth=convertHorizontalDLUsToPixels(OwlUI.MIN_DIALOG_WIDTH_DLU);
  int minHeight=shell.computeSize(minWidth,SWT.DEFAULT).y;
  Point requiredSize=shell.computeSize(SWT.DEFAULT,SWT.DEFAULT);
  shell.setSize(Math.max(minWidth,requiredSize.x),Math.max(minHeight,requiredSize.y));
  LayoutUtils.positionShell(shell);
}
 

Project Name: rssowl.ui Package: org.rssowl.ui.internal.dialogs

Source Code: CleanUpReminderDialog.java (Click to view .java file)

Method Code:
vote
like

@Override protected void initializeBounds(){
  super.initializeBounds();
  Shell shell=getShell();
  int maxWidth=convertHorizontalDLUsToPixels(OwlUI.MIN_DIALOG_WIDTH_DLU);
  int maxHeight=500;
  Point requiredSize=shell.computeSize(SWT.DEFAULT,SWT.DEFAULT);
  shell.setSize(Math.min(maxWidth,requiredSize.x),Math.min(maxHeight,requiredSize.y));
  LayoutUtils.positionShell(shell);
}
 

Project Name: rssowl.ui Package: org.rssowl.ui.internal.dialogs

Source Code: PreviewFeedDialog.java (Click to view .java file)

Method Code:
vote
like

@Override protected void initializeBounds(){
  super.initializeBounds();
  Shell shell=getShell();
  int minWidth=convertHorizontalDLUsToPixels(DIALOG_WIDTH_DLUS);
  int minHeight=convertHorizontalDLUsToPixels(DIALOG_HEIGHT_DLUS);
  Point requiredSize=shell.computeSize(SWT.DEFAULT,SWT.DEFAULT);
  shell.setSize(Math.max(minWidth,requiredSize.x),Math.max(minHeight,requiredSize.y));
  if (fFirstTimeOpen)   LayoutUtils.positionShell(shell);
}
 

Project Name: rssowl.ui Package: org.rssowl.ui.internal.dialogs

Source Code: SearchMarkDialog.java (Click to view .java file)

Method Code:
vote
like

@Override protected void initializeBounds(){
  super.initializeBounds();
  if (fFirstTimeOpen) {
    Point requiredSize=getShell().computeSize(SWT.DEFAULT,SWT.DEFAULT);
    if (Application.IS_LINUX)     requiredSize.x=requiredSize.x + 100;
 else     if (Application.IS_MAC)     requiredSize.x=requiredSize.x + 50;
    getShell().setSize(requiredSize);
    LayoutUtils.positionShell(getShell());
  }
}
 

Project Name: rssowl.ui Package: org.rssowl.ui.internal.dialogs

Source Code: AggregateNewsDialog.java (Click to view .java file)

Method Code:
vote
like

@Override protected void initializeBounds(){
  super.initializeBounds();
  Point bestSize=getShell().computeSize(convertHorizontalDLUsToPixels(OwlUI.MIN_DIALOG_WIDTH_DLU),SWT.DEFAULT);
  Point location=getInitialLocation(bestSize);
  getShell().setBounds(location.x,location.y,bestSize.x,bestSize.y);
}
 

Project Name: rssowl.ui Package: org.rssowl.ui.internal.dialogs.cleanup

Source Code: FeedSelectionPage.java (Click to view .java file)

Method Code:
vote
like

private void showFeeds(IStructuredSelection selection){
  if (!selection.isEmpty()) {
    Object[] elements=selection.toArray();
    int offset=0;
    for (    Object element : elements) {
      if (element instanceof IBookMark) {
        IBookMark bookmark=(IBookMark)element;
        PreviewFeedDialog dialog=new PreviewFeedDialog(getShell(),bookmark,bookmark.getFeedLinkReference());
        dialog.setBlockOnOpen(false);
        dialog.open();
        if (offset != 0) {
          Point location=dialog.getShell().getLocation();
          dialog.getShell().setLocation(location.x + offset,location.y + offset);
        }
        offset+=20;
      }
    }
  }
}
 

Project Name: rssowl.ui Package: org.rssowl.ui.internal.dialogs.importer

Source Code: ImportElementsPage.java (Click to view .java file)

Method Code:
vote
like

private void openPreview(ISelection selection){
  IStructuredSelection sel=(IStructuredSelection)selection;
  if (!sel.isEmpty()) {
    Object[] elements=sel.toArray();
    int offset=0;
    for (    Object element : elements) {
      if (element instanceof IBookMark) {
        IBookMark bookmark=(IBookMark)element;
        IFeed loadedFeed=fLoadedFeedCache.get(bookmark.getFeedLinkReference().getLink());
        PreviewFeedDialog dialog=new PreviewFeedDialog(getShell(),bookmark,loadedFeed);
        dialog.setBlockOnOpen(false);
        dialog.open();
        if (offset != 0) {
          Point location=dialog.getShell().getLocation();
          dialog.getShell().setLocation(location.x + offset,location.y + offset);
        }
        offset+=20;
      }
    }
  }
}
 

Project Name: rssowl.ui Package: org.rssowl.ui.internal.dialogs.properties

Source Code: EntityPropertyDialog.java (Click to view .java file)

Method Code:
vote
like

public void contentsChanged(){
  Shell shell=getShell();
  Point requiredSize=getRequiredSize(shell);
  Point currentSize=shell.getSize();
  if (requiredSize.x > currentSize.x || requiredSize.y > currentSize.y)   shell.setSize(new Point(Math.max(currentSize.x,requiredSize.x),Math.max(currentSize.y,requiredSize.y)));
}
 

Project Name: rssowl.ui Package: org.rssowl.ui.internal.editors.feed

Source Code: NewsTableControl.java (Click to view .java file)

Method Code:
vote
like

private boolean isInImageBounds(TreeItem item,NewsColumn column,Point p){
  int index=indexOf(column);
  if (index == -1)   return false;
  return item.getImageBounds(index).contains(p);
}
 

Project Name: rssowl.ui Package: org.rssowl.ui.internal.filter

Source Code: NewsActionList.java (Click to view .java file)

Method Code:
vote
like

public void handleEvent(Event event){
  if (event.detail == SWT.ARROW) {
    Rectangle rect=item.getBounds();
    Point pt=new Point(rect.x,rect.y + rect.height);
    pt=buttonBar.toDisplay(pt);
    actionMenu.setLocation(pt.x,pt.y);
    actionMenu.setVisible(true);
  }
 else   onAdd(item);
}
 

Project Name: rssowl.ui Package: org.rssowl.ui.internal.notifier

Source Code: NotificationPopup.java (Click to view .java file)

Method Code:
vote
like

@Override protected Point getInitialLocation(Point initialSize){
  Rectangle clArea=getPrimaryClientArea();
  return new Point(clArea.width + clArea.x - initialSize.x,clArea.height + clArea.y - initialSize.y);
}
 

Project Name: rssowl.ui Package: org.rssowl.ui.internal.search

Source Code: LocationControl.java (Click to view .java file)

Method Code:
vote
like

@Override protected void initializeBounds(){
  super.initializeBounds();
  Point bestSize=getShell().computeSize(convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH),SWT.DEFAULT);
  getShell().setSize(bestSize);
  LayoutUtils.positionShell(getShell());
}
 

Project Name: rssowl.ui Package: org.rssowl.ui.internal.search

Source Code: StateConditionControl.java (Click to view .java file)

Method Code:
vote
like

@Override public void widgetSelected(SelectionEvent e){
  if (fUnreadState.getSelection() && !fNewState.getSelection()) {
    Point toolTipLocation=toDisplay(fNewState.getLocation());
    toolTipLocation.y+=fNewState.getSize().y;
    if (Application.IS_WINDOWS)     toolTipLocation.x+=5;
 else     if (Application.IS_LINUX)     toolTipLocation.x+=12;
    newStateToolTip.setLocation(toolTipLocation);
    newStateToolTip.setVisible(true);
  }
 else {
    newStateToolTip.setVisible(false);
  }
}
 

Project Name: rssowl.ui Package: org.rssowl.ui.internal.search

Source Code: SearchConditionList.java (Click to view .java file)

Method Code:
vote
like

public void handleEvent(Event event){
  if (event.detail == SWT.ARROW) {
    Rectangle rect=item.getBounds();
    Point pt=new Point(rect.x,rect.y + rect.height);
    pt=buttonBar.toDisplay(pt);
    conditionMenu.setLocation(pt.x,pt.y);
    conditionMenu.setVisible(true);
  }
 else   onAdd(item);
}
 

Project Name: rssowl.ui Package: org.rssowl.ui.internal.util

Source Code: ColorPicker.java (Click to view .java file)

Method Code:
vote
like

private void initControl(int style){
  fBar=new ToolBar(fParent,style);
  OwlUI.makeAccessible(fBar,Messages.ColorPicker_COLOR_LABEL);
  fBar.addDisposeListener(new DisposeListener(){
    public void widgetDisposed(    DisposeEvent e){
      OwlUI.safeDispose(fColorMenu);
      for (      Image img : fImagesToDispose) {
        img.dispose();
      }
    }
  }
);
  createColorMenu();
  fColorItem=new ToolItem(fBar,SWT.DROP_DOWN);
  fColorItem.setImage(createColorImage(fSelectedColor));
  fColorItem.addListener(SWT.Selection,new Listener(){
    public void handleEvent(    Event event){
      Rectangle rect=fColorItem.getBounds();
      Point pt=new Point(rect.x,rect.y + rect.height);
      pt=fBar.toDisplay(pt);
      fColorMenu.setLocation(pt.x,pt.y);
      fColorMenu.setVisible(true);
    }
  }
);
}
 

Project Name: rssowl.ui Package: org.rssowl.ui.internal.util

Source Code: ColorPicker.java (Click to view .java file)

Method Code:
vote
like

public void handleEvent(Event event){
  Rectangle rect=fColorItem.getBounds();
  Point pt=new Point(rect.x,rect.y + rect.height);
  pt=fBar.toDisplay(pt);
  fColorMenu.setLocation(pt.x,pt.y);
  fColorMenu.setVisible(true);
}
 

Project Name: rssowl.ui Package: org.rssowl.ui.internal.util

Source Code: ContentAssistAdapter.java (Click to view .java file)

Method Code:
vote
like

private void setSelection(Point selection){
  if (fControl instanceof Text)   ((Text)fControl).setSelection(selection);
 else   ((Combo)fControl).setSelection(selection);
}
 

Project Name: rssowl.ui Package: org.rssowl.ui.internal.util

Source Code: LayoutUtils.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Sets the initial location to use for the shell. The default implementation
 * centers the shell horizontally (1/2 of the difference to the left and 1/2
 * to the right) and vertically (1/3 above and 2/3 below) relative to the
 * parent shell
 * @param shell The shell to set the location
 */
public static void positionShell(Shell shell){
  Rectangle containerBounds=shell.getParent().getBounds();
  Point initialSize=shell.getSize();
  int x=Math.max(0,containerBounds.x + (containerBounds.width - initialSize.x) / 2);
  int y=Math.max(0,containerBounds.y + (containerBounds.height - initialSize.y) / 3);
  shell.setLocation(x,y);
}
 

Project Name: rssowl.ui Package: org.rssowl.ui.internal.util

Source Code: NewsColumnSelectionControl.java (Click to view .java file)

Method Code:
vote
like

private GridData setButtonLayoutData(Button button){
  GridData data=new GridData(GridData.HORIZONTAL_ALIGN_FILL);
  int widthHint=Dialog.convertHorizontalDLUsToPixels(fFontMetrics,IDialogConstants.BUTTON_WIDTH);
  Point minSize=button.computeSize(SWT.DEFAULT,SWT.DEFAULT,true);
  data.widthHint=Math.max(widthHint,minSize.x);
  button.setLayoutData(data);
  return data;
}
 

Project Name: rssowl.ui Package: org.rssowl.ui.internal.util

Source Code: FolderChooser.java (Click to view .java file)

Method Code:
vote
like

private void onToggle(){
  boolean excluded=((GridData)fFolderViewerContainer.getLayoutData()).exclude;
  fToggleItem.setImage(OwlUI.getImage(fResources,excluded ? "icons/ovr16/arrow_up.gif" : "icons/ovr16/arrow_down.gif"));
  fToggleItem.setToolTipText(excluded ? Messages.FolderChooser_HIDE_FOLDERS : Messages.FolderChooser_SHOW_FOLDERS);
  ((GridData)fFolderViewerContainer.getLayoutData()).exclude=!excluded;
  Shell shell=fFolderViewerContainer.getShell();
  shell.layout();
  fAddFolderBar.setVisible(excluded);
  if (fExpandStrategy == ExpandStrategy.RESIZE) {
    Point size=shell.getSize();
    shell.setSize(size.x,size.y + (excluded ? fViewerHeight : -fViewerHeight));
  }
 else {
    int currentWidth=shell.getSize().x;
    Point desiredSize=shell.computeSize(currentWidth,SWT.DEFAULT);
    if (desiredSize.y > shell.getSize().y)     shell.setSize(currentWidth,desiredSize.y);
 else     shell.layout(true,true);
  }
  if (excluded)   fFolderViewer.getTree().setFocus();
 else   fFolderViewer.getTree().getShell().setFocus();
}