Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


Eclipse Platform
Release 3.5

org.eclipse.jface.action
Class ControlContribution


java.lang.Object
  extended by 

org.eclipse.jface.action.ContributionItem
      extended by 
org.eclipse.jface.action.ControlContribution
All Implemented Interfaces:
IContributionItem
Direct Known Subclasses:
org.eclipse.ui.internal.menus.InternalControlContribution

public abstract class ControlContribution
extends ContributionItem

An abstract contribution item implementation for adding an arbitrary SWT control to a tool bar. Note, however, that these items cannot be contributed to menu bars.

The createControl framework method must be implemented by concrete subclasses.


Constructor Summary
protected ControlContribution ( String id)
          Creates a control contribution item with the given id.
 
Method Summary
protected  int computeWidth ( Control control)
          Computes the width of the given control which is being added to a tool bar.
protected abstract   Control createControl ( Composite parent)
          Creates and returns the control for this contribution item under the given parent composite.
 void fill ( Composite parent)
          The control item implementation of this IContributionItem method calls the createControl framework method.
 void fill ( Menu parent, int index)
          The control item implementation of this IContributionItem method throws an exception since controls cannot be added to menus.
 void fill ( ToolBar parent, int index)
          The control item implementation of this IContributionItem method calls the createControl framework method to create a control under the given parent, and then creates a new tool item to hold it.
 
Methods inherited from class org.eclipse.jface.action. ContributionItem
dispose, fill, getId, getParent, isDirty, isDynamic, isEnabled, isGroupMarker, isSeparator, isVisible, saveWidgetState, setId, setParent, setVisible, toString, update, update
 
Methods inherited from class java.lang. Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ControlContribution

protected ControlContribution(
String id)
Creates a control contribution item with the given id.

Parameters:
id - the contribution item id
Method Detail

computeWidth

protected int computeWidth(
Control control)
Computes the width of the given control which is being added to a tool bar. This is needed to determine the width of the tool bar item containing the given control.

The default implementation of this framework method returns control.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x. Subclasses may override if required.

Parameters:
control - the control being added
Returns:
the width of the control

createControl

protected abstract 
Control createControl(
Composite parent)
Creates and returns the control for this contribution item under the given parent composite.

This framework method must be implemented by concrete subclasses.

Parameters:
parent - the parent composite
Returns:
the new control

fill

public final void fill(
Composite parent)
The control item implementation of this IContributionItem method calls the createControl framework method. Subclasses must implement createControl rather than overriding this method.

Specified by:
fill in interface IContributionItem
Overrides:
fill in class ContributionItem
Parameters:
parent - the parent control

fill

public final void fill(
Menu parent,
                       int index)
The control item implementation of this IContributionItem method throws an exception since controls cannot be added to menus.

Specified by:
fill in interface IContributionItem
Overrides:
fill in class ContributionItem
Parameters:
parent - the parent menu
index - the index where the controls are inserted, or -1 to insert at the end

fill

public final void fill(
ToolBar parent,
                       int index)
The control item implementation of this IContributionItem method calls the createControl framework method to create a control under the given parent, and then creates a new tool item to hold it. Subclasses must implement createControl rather than overriding this method.

Specified by:
fill in interface IContributionItem
Overrides:
fill in class ContributionItem
Parameters:
parent - the parent tool bar
index - the index where the controls are inserted, or -1 to insert at the end

Eclipse Platform
Release 3.5

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire