Java Code Examples for org.eclipse.jface.action.ToolBarManager

The following are top voted examples for showing how to use org.eclipse.jface.action.ToolBarManager. 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: Hydrograph   File: ExecutionTrackingConsole.java   View source code 6 votes vote down vote up
/**
 * Create the coolbar manager.
 *
 * @param style the style
 * @return the coolbar manager
 */
@Override
protected CoolBarManager createCoolBarManager(int style) {
	
	CoolBarManager coolBarManager = new CoolBarManager(style);

	actionFactory = new ActionFactory(this);

	ToolBarManager toolBarManager = new ToolBarManager();
	coolBarManager.add(toolBarManager);
	addtoolbarAction(toolBarManager, ImagePathConstant.CLEAR_EXEC_TRACKING_CONSOLE,
			actionFactory.getAction(ClearConsoleAction.class.getName()));
	addtoolbarAction(toolBarManager, ImagePathConstant.CONSOLE_SCROLL_LOCK, 
			actionFactory.getAction(ScrollLockAction.class.getName()));
	
	return coolBarManager;
}
 
Example 2
Project: avro-schema-editor   File: SchemaToolBarConfigurationImpl.java   View source code 6 votes vote down vote up
protected void fillEditionToolBar(ToolBarManager manager) {
	// add element
	AddContextualAction(manager, 
			new AddElementAction("Add new element", IAction.AS_PUSH_BUTTON, Notifications.notifyRefreshReveal(getContext())));		
	// remove element
	AddContextualAction(manager, 
			new RemoveElementAction("Remove element(s)", IAction.AS_PUSH_BUTTON, Notifications.NOT_REF));		
	// move up
	AddContextualAction(manager, 
			new MoveInDirectionAction(MoveInDirectionAction.getLabel(Direction.UP), IAction.AS_PUSH_BUTTON, Direction.UP, Notifications.NOT_REF));
	// move down
	AddContextualAction(manager,
			new MoveInDirectionAction(MoveInDirectionAction.getLabel(Direction.DOWN), IAction.AS_PUSH_BUTTON, Direction.DOWN, Notifications.NOT_REF));		
	// copy
	AddContextualAction(manager,		
			new CopyElementAction("Copy element(s)", IAction.AS_PUSH_BUTTON, Notifications.NONE));
	// paste
	AddContextualAction(manager,
			new PasteElementAction("Paste element(s)", IAction.AS_PUSH_BUTTON, Notifications.NOT_REF));
}
 
Example 3
Project: subclipse   File: SvnWizardLockPage.java   View source code 6 votes vote down vote up
private void addResourcesArea(Composite composite) {  
	ResourceSelectionTree.IToolbarControlCreator toolbarControlCreator = new ResourceSelectionTree.IToolbarControlCreator() {
  public void createToolbarControls(ToolBarManager toolbarManager) {
    toolbarManager.add(new ControlContribution("stealLock") {
      protected Control createControl(Composite parent) {
        stealButton = new Button(parent, SWT.CHECK);
        stealButton.setText(Policy.bind("LockDialog.stealLock")); //$NON-NLS-1$		
        return stealButton;
      }
    });
  }
  public int getControlCount() {
    return 1;
  }
};
	resourceSelectionTree = new ResourceSelectionTree(composite, SWT.NONE, "These files will be locked:", files, new HashMap(), null, false, toolbarControlCreator, null); //$NON-NLS-1$    	
	resourceSelectionTree.setShowRemoveFromViewAction(false);
}
 
Example 4
Project: javapasswordsafe   File: PasswordSafeJFace.java   View source code 6 votes vote down vote up
/**
 * @see org.eclipse.jface.window.ApplicationWindow#createToolBarManager(int)
 */
@Override
protected ToolBarManager createToolBarManager(final int style) {
	final ToolBarManager toolBarManager = new ToolBarManager(style);

	toolBarManager.add(newFileAction);
	toolBarManager.add(openFileAction);
	toolBarManager.add(saveFileAction);
	toolBarManager.add(new Separator());
	toolBarManager.add(copyUsernameAction);
	toolBarManager.add(copyPasswordAction);
	toolBarManager.add(copyURLAction);
	toolBarManager.add(openUrlAction);
	toolBarManager.add(clearClipboardAction);
	toolBarManager.add(new Separator());
	toolBarManager.add(addRecordAction);
	toolBarManager.add(editRecordAction);
	toolBarManager.add(deleteRecordAction);
	toolBarManager.add(new Separator());
	toolBarManager.add(helpAction);
	return toolBarManager;
}
 
Example 5
Project: xstreamer   File: BrowserActionBarAdvisor.java   View source code 6 votes vote down vote up
@Override
protected void fillCoolBar(ICoolBarManager coolBar) {
	IToolBarManager toolBar = new ToolBarManager(SWT.FLAT | SWT.RIGHT);
	coolBar.add(new ToolBarContributionItem(toolBar, "standard")); //$NON-NLS-1$
	
	// For the Back and Forward actions, force their text to be shown on the toolbar,
	// not just their image.  For the remaining actions, the ActionContributionItem
	// is created implicitly with the default presentation mode.
	ActionContributionItem backCI = new ActionContributionItem(backAction);
	backCI.setMode(ActionContributionItem.MODE_FORCE_TEXT);
	toolBar.add(backCI);
	
	ActionContributionItem forwardCI = new ActionContributionItem(forwardAction);
	forwardCI.setMode(ActionContributionItem.MODE_FORCE_TEXT);
	toolBar.add(forwardCI);

	toolBar.add(stopAction);
	toolBar.add(refreshAction);
}
 
Example 6
Project: PDFReporter-Studio   File: TFContainer.java   View source code 6 votes vote down vote up
public TFContainer(Composite parent, int style) {
	super(parent, style);
	GridLayout layout = new GridLayout(2,false);
	layout.marginHeight = 0;
	layout.marginWidth = 0;
	layout.verticalSpacing = 0;
	setLayout(layout);

	toolBar = new ToolBar(this, SWT.HORIZONTAL | SWT.FLAT | SWT.WRAP | SWT.RIGHT);
	
	additionalToolbar = new ToolBar(this, SWT.HORIZONTAL | SWT.FLAT | SWT.WRAP | SWT.RIGHT);
	GridData additionalToolbarGD = new GridData(SWT.RIGHT, SWT.CENTER, true, false);
	additionalToolbar.setLayoutData(additionalToolbarGD);
	additionalToolbarManager = new ToolBarManager(additionalToolbar);
	
	content = new Composite(this, SWT.NONE);
	stackLayout = new StackLayout();
	stackLayout.marginWidth = 0;
	stackLayout.marginHeight = 0;
	content.setLayout(stackLayout);
	content.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
}
 
Example 7
Project: PDFReporter-Studio   File: LeftToolBarManager.java   View source code 6 votes vote down vote up
@Override
protected void createToolBar(Composite parent) {
	prmtbar = new Composite(parent, SWT.NONE);
	prmtbar.setLayout(new GridLayout(2, false));
	prmtbar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

	label = new Label(prmtbar, SWT.NONE);
	label.setText(Messages.LeftToolBarManager_label);
	label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

	topToolBar = new ToolBar(prmtbar, SWT.FLAT | SWT.WRAP | SWT.RIGHT);

	tbManager = new ToolBarManager(topToolBar);

	fillToolbar(tbManager);

	refreshToolbar();
}
 
Example 8
Project: limpet   File: ApplicationWorkbenchWindowAdvisor.java   View source code 6 votes vote down vote up
public Control createEmptyWindowContents(Composite parent)
{
  final IWorkbenchWindow window = getWindowConfigurer().getWindow();
  Composite composite = new Composite(parent, SWT.NONE);
  composite.setLayout(new GridLayout(2, false));
  Display display = composite.getDisplay();
  Color bgCol = display.getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND);
  composite.setBackground(bgCol);
  Label label = new Label(composite, SWT.WRAP);
  label.setForeground(display
      .getSystemColor(SWT.COLOR_TITLE_INACTIVE_FOREGROUND));
  label.setBackground(bgCol);
  label.setFont(JFaceResources.getFontRegistry().getBold(
      JFaceResources.DEFAULT_FONT));
  String msg = IDEWorkbenchMessages.IDEWorkbenchAdvisor_noPerspective;
  label.setText(msg);
  ToolBarManager toolBarManager = new ToolBarManager();
  // TODO: should obtain the open perspective action from ActionFactory
  openPerspectiveAction =
      ActionFactory.OPEN_PERSPECTIVE_DIALOG.create(window);
  toolBarManager.add(openPerspectiveAction);
  ToolBar toolBar = toolBarManager.createControl(composite);
  toolBar.setBackground(bgCol);
  return composite;
}
 
Example 9
Project: APICloud-Studio   File: AbstractDocumentationHover.java   View source code 6 votes vote down vote up
public IInformationControl doCreateInformationControl(Shell parent)
{
	if (BrowserInformationControl.isAvailable(parent))
	{
		ToolBarManager tbm = new ToolBarManager(SWT.FLAT);
		CustomBrowserInformationControl iControl = new CustomBrowserInformationControl(parent, null, tbm);
		iControl.setBackgroundColor(documentationHover.getBackgroundColor());
		iControl.setForegroundColor(documentationHover.getForegroundColor());
		documentationHover.populateToolbarActions(tbm, iControl);
		tbm.update(true);
		documentationHover.installLinkListener(iControl);
		return iControl;
	}
	else
	{
		return new DefaultInformationControl(parent, true);
	}
}
 
Example 10
Project: APICloud-Studio   File: CustomAbstractInformationControl.java   View source code 6 votes vote down vote up
private void createToolBar(ToolBarManager toolBarManager)
{
	final Composite bars = new Composite(fStatusComposite, SWT.NONE);
	bars.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));

	GridLayout layout = new GridLayout(3, false);
	layout.marginHeight = 0;
	layout.marginWidth = 0;
	layout.horizontalSpacing = 0;
	layout.verticalSpacing = 0;
	bars.setLayout(layout);

	fToolBar = toolBarManager.createControl(bars);
	GridData gd = new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false);
	fToolBar.setLayoutData(gd);

	Composite spacer = new Composite(bars, SWT.NONE);
	gd = new GridData(SWT.FILL, SWT.FILL, true, true);
	gd.widthHint = 0;
	gd.heightHint = 0;
	spacer.setLayoutData(gd);

	addMoveSupport(spacer);
	addResizeSupportIfNecessary(bars);
}
 
Example 11
Project: APICloud-Studio   File: SvnWizardLockPage.java   View source code 6 votes vote down vote up
private void addResourcesArea(Composite composite) {  
	ResourceSelectionTree.IToolbarControlCreator toolbarControlCreator = new ResourceSelectionTree.IToolbarControlCreator() {
  public void createToolbarControls(ToolBarManager toolbarManager) {
    toolbarManager.add(new ControlContribution("stealLock") {
      protected Control createControl(Composite parent) {
        stealButton = new Button(parent, SWT.CHECK);
        stealButton.setText(Policy.bind("LockDialog.stealLock")); //$NON-NLS-1$		
        return stealButton;
      }
    });
  }
  public int getControlCount() {
    return 1;
  }
};
	resourceSelectionTree = new ResourceSelectionTree(composite, SWT.NONE, "These files will be locked:", files, new HashMap(), null, false, toolbarControlCreator, null); //$NON-NLS-1$    	
	resourceSelectionTree.setShowRemoveFromViewAction(false);
}
 
Example 12
Project: APICloud-Studio   File: JSTextHover.java   View source code 6 votes vote down vote up
@Override
public void populateToolbarActions(ToolBarManager tbm, CustomBrowserInformationControl iControl)
{
	final OpenDeclarationAction openDeclarationAction = new OpenDeclarationAction(iControl);
	final OpenHelpAction openHelpAction = new OpenHelpAction(iControl);
	tbm.add(openDeclarationAction);
	tbm.add(openHelpAction);
	IInputChangedListener inputChangeListener = new IInputChangedListener()
	{
		public void inputChanged(Object newInput)
		{
			if (newInput instanceof BrowserInformationControlInput)
			{
				openDeclarationAction.update();
				openHelpAction.update();
			}
		}
	};
	iControl.addInputChangeListener(inputChangeListener);
}
 
Example 13
Project: APICloud-Studio   File: WebBrowserViewer.java   View source code 6 votes vote down vote up
private void createNavigationBar(Composite parent)
{
	toolBarManager = new ToolBarManager(SWT.FLAT);
	toolBarManager.add(consoleAction);
	toolBarManager.add(backAction);
	toolBarManager.add(forwardAction);
	toolBarManager.add(stopAction);
	toolBarManager.add(refreshAction);
	ToolBar toolbar = toolBarManager.createControl(parent);
	toolbar.setLayoutData(GridDataFactory.fillDefaults().create());

	urlCombo = new Combo(parent, SWT.DROP_DOWN);
	urlCombo.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
	urlCombo.addListener(SWT.DefaultSelection, new Listener() {
		
		@Override
		public void handleEvent(Event e) {
			setURL(urlCombo.getText());
		}
	});

	ToolBarManager toolBarManager2 = new ToolBarManager(SWT.FLAT);
	toolBarManager2.add(goAction);
	toolbar = toolBarManager2.createControl(parent);
	toolbar.setLayoutData(GridDataFactory.fillDefaults().create());
}
 
Example 14
Project: APICloud-Studio   File: HTMLTextHover.java   View source code 6 votes vote down vote up
@Override
public void populateToolbarActions(ToolBarManager tbm, CustomBrowserInformationControl iControl)
{
	// @formatter:off
	/*
	final OpenDOMReferenceAction openReferenceAction = new OpenDOMReferenceAction(iControl);
	tbm.add(openReferenceAction);
	IInputChangedListener inputChangeListener = new IInputChangedListener()
	{

		public void inputChanged(Object newInput)
		{
			if (newInput instanceof BrowserInformationControlInput)
			{
				openReferenceAction.update();
			}
		}
	};
	iControl.addInputChangeListener(inputChangeListener);
	*/
	// @formatter:on
}
 
Example 15
Project: durian-swt   File: CoatMuxTest.java   View source code 6 votes vote down vote up
@Test
public void ctabFolderTest() {
	InteractiveTest.testCoat("Test coat mux layout behavior inside a CTabFolder.", cmp -> {
		Layouts.setGrid(cmp);
		CTabFolder folder = new CTabFolder(cmp, SWT.BORDER | SWT.CLOSE);
		Layouts.setGridData(folder).grabAll();

		ToolBarManager manager = new ToolBarManager();
		manager.add(Actions.create("Add", () -> {
			CTabItem item = new CTabItem(folder, SWT.NONE);
			item.setText("New control");
			Composite parent = new Composite(folder, SWT.NONE);
			randomColorMux(parent);
			item.setControl(parent);
			item.addListener(SWT.Dispose, e -> item.getControl().dispose());
			folder.setSelection(item);
		}));
		Layouts.setGridData(manager.createControl(cmp)).grabHorizontal();
	});
}
 
Example 16
Project: mytourbook   File: DialogSelectMap3Color.java   View source code 6 votes vote down vote up
private void createUI_20_Actions(final Composite parent) {

		final Composite container = new Composite(parent, SWT.NONE);
		GridDataFactory.fillDefaults().grab(true, false).applyTo(container);
		GridLayoutFactory
				.fillDefaults()//
				.numColumns(2)
				.extendedMargins(2, 0, 3, 2)
				.applyTo(container);
		{

			final ToolBar toolbar = new ToolBar(container, SWT.FLAT);

			final ToolBarManager tbm = new ToolBarManager(toolbar);

			tbm.add(_actionAddColor);
			tbm.add(_actionEditSelectedColor);
			tbm.add(_actionEditAllColors);

			tbm.update(true);
		}
	}
 
Example 17
Project: mytourbook   File: PhotoToolTipUI.java   View source code 6 votes vote down vote up
private void fillActionBar() {

		/*
		 * fill exit toolbar
		 */
		final ToolBarManager exitToolbarManager = new ToolBarManager(_ttToolbarControlExit);

		exitToolbarManager.add(_actionCloseToolTip);
		exitToolbarManager.add(_actionPinToolTip);
		exitToolbarManager.add(_actionToolTipLocation);

		exitToolbarManager.update(true);

		/*
		 * fill gallery toolbar
		 */
		_galleryToolbarManager = new ToolBarManager(_galleryToolbarControl);

		_galleryToolbarManager.add(_actionToggleGalleryOrientation);
		_galleryToolbarManager.add(new Separator());
	}
 
Example 18
Project: mytourbook   File: ValuePointToolTipUI.java   View source code 6 votes vote down vote up
private void createUI_030_Actions(final Composite parent) {

		/*
		 * create toolbar
		 */
		_toolbarControl = new ToolBar(parent, SWT.FLAT);
		GridDataFactory.fillDefaults()//
//				.align(SWT.END, SWT.FILL)
				.align(SWT.END, SWT.BEGINNING)
				.applyTo(_toolbarControl);
		_toolbarControl.setForeground(_fgColor);
		_toolbarControl.setBackground(_bgColor);
//		_toolbarControl.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_YELLOW));
//		_toolbarControl.setBackground(_fgToolbar);

		final ToolBarManager tbm = new ToolBarManager(_toolbarControl);

		tbm.add(_actionOpenTooltipMenu);

		tbm.update(true);
	}
 
Example 19
Project: mytourbook   File: SlideoutStatisticOptions.java   View source code 6 votes vote down vote up
private void createUI_12_Actions(final Composite parent) {

		final ToolBar toolbar = new ToolBar(parent, SWT.FLAT);
		GridDataFactory
				.fillDefaults()//
				.grab(true, false)
				.align(SWT.END, SWT.BEGINNING)
				.applyTo(toolbar);

		final ToolBarManager tbm = new ToolBarManager(toolbar);

		tbm.add(_actionRestoreDefaults);
		tbm.add(_actionPrefDialog);

		tbm.update(true);
	}
 
Example 20
Project: mytourbook   File: PicDirImages.java   View source code 6 votes vote down vote up
/**
 * fill gallery actionbar
 * 
 * @param galleryActionBarContainer
 */
private void createUI_20_GalleryToolbars(final Composite galleryActionBarContainer) {

	/*
	 * toolbar actions
	 */
	_galleryToolbar = new ToolBar(galleryActionBarContainer, SWT.FLAT);
	GridDataFactory.fillDefaults()//
			.align(SWT.BEGINNING, SWT.CENTER)
			.applyTo(_galleryToolbar);

	final ToolBarManager tbm = new ToolBarManager(_galleryToolbar);

	tbm.add(_actionToggleFolderGallery);
	tbm.add(_actionNavigateBackward);
	tbm.add(_actionNavigateForward);

	tbm.update(true);
}
 
Example 21
Project: n4js   File: TestResultsView.java   View source code 5 votes vote down vote up
private void contributeToActionBars() {
	final IActionBars bars = getViewSite().getActionBars();
	fillLocalPullDown(bars.getMenuManager());
	fillLocalToolBar(bars.getToolBarManager());
	// a custom tool bar works slightly differently:
	final ToolBarManager m = new ToolBarManager(toolBar);
	fillCustomToolBar(m);
	m.update(true);
}
 
Example 22
Project: android-uiautomatorviewer   File: UiAutomatorViewer.java   View source code 5 votes vote down vote up
@Override
protected Control createContents(Composite parent) {
  Composite c = new Composite(parent, SWT.BORDER);

  GridLayout gridLayout = new GridLayout(1, false);
  gridLayout.marginWidth = 0;
  gridLayout.marginHeight = 0;
  gridLayout.horizontalSpacing = 0;
  gridLayout.verticalSpacing = 0;
  c.setLayout(gridLayout);

  GridData gd = new GridData(GridData.FILL_HORIZONTAL);
  c.setLayoutData(gd);

  ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
  toolBarManager.add(new OpenFilesAction(this));
  toolBarManager.add(new ScreenshotAction(this, false));
  toolBarManager.add(new ScreenshotAction(this, true));
  toolBarManager.add(new SaveScreenShotAction(this));
  ToolBar tb = toolBarManager.createControl(c);
  tb.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

  mUiAutomatorView = new UiAutomatorView(c, SWT.BORDER);
  mUiAutomatorView.setLayoutData(new GridData(GridData.FILL_BOTH));

  return parent;
}
 
Example 23
Project: neoscada   File: ApplicationActionBarAdvisor.java   View source code 5 votes vote down vote up
@Override
protected void fillCoolBar ( final ICoolBarManager coolBar )
{
    final IToolBarManager toolbar = new ToolBarManager ( SWT.FLAT | SWT.RIGHT );
    coolBar.add ( new ToolBarContributionItem ( toolbar, "main" ) );
    toolbar.add ( getAction ( ActionFactory.NEW_WIZARD_DROP_DOWN.getId () ) );
    coolBar.add ( new GroupMarker ( IWorkbenchActionConstants.MB_ADDITIONS ) );
}
 
Example 24
Project: Hydrograph   File: ComponentFigure.java   View source code 5 votes vote down vote up
private ComponentTooltip getToolBarToolTip(Shell parent, org.eclipse.swt.graphics.Rectangle toltipBounds) {
	ToolBarManager toolBarManager = new ToolBarManager();
	ComponentTooltip tooltip = new ComponentTooltip(component,parent, toolBarManager, propertyToolTipInformation);
	org.eclipse.swt.graphics.Point location = new org.eclipse.swt.graphics.Point(toltipBounds.x, toltipBounds.y);
	tooltip.setLocation(location);
	tooltip.setSize(toltipBounds.width + 20, toltipBounds.height + 20);
	return tooltip;
}
 
Example 25
Project: Hydrograph   File: ComponentTooltip.java   View source code 5 votes vote down vote up
/**
 * 
 * create tooltip with toolbar
 * 
 * @param parent
 * @param toolBarManager
 * @param propertyToolTipInformation
 */
public ComponentTooltip(Component component,Shell parent, ToolBarManager toolBarManager,Map<String,PropertyToolTipInformation> propertyToolTipInformation) {
	super(parent, toolBarManager);
	this.toolBarManager= getToolBarManager();
	this.component=component;
	this.componentToolTipInformation = propertyToolTipInformation;		
	logger.debug("ComponentTooltip.ComponentTooltip: Creating tooltip with toolbar: " + this.toolBarManager + " , " + this.componentToolTipInformation.toString());
	create();
}
 
Example 26
Project: Hydrograph   File: DebugDataViewer.java   View source code 5 votes vote down vote up
private void addtoolbarAction(ToolBarManager toolBarManager, final ImagePathConstant imagePath, Action action) {

		ImageDescriptor exportImageDescriptor = new ImageDescriptor() {
			@Override
			public ImageData getImageData() {
				return imagePath.getImageFromRegistry().getImageData();
			}
		};
		action.setImageDescriptor(exportImageDescriptor);
		toolBarManager.add(action);
	}
 
Example 27
Project: Hydrograph   File: ApplicationActionBarAdvisor.java   View source code 5 votes vote down vote up
@Override
  protected void fillCoolBar(ICoolBarManager coolBar) {
  	super.fillCoolBar(coolBar);
  	IToolBarManager toolbar = new ToolBarManager(SWT.FLAT | SWT.LEFT);
coolBar.add(new ToolBarContributionItem(toolbar, HYDROGRAPH_UI_GRAPH_TOOLBAR_ID));

  }
 
Example 28
Project: Hydrograph   File: ExecutionTrackingConsole.java   View source code 5 votes vote down vote up
/**
 * Addtoolbar action.
 *
 * @param toolBarManager the tool bar manager
 * @param imagePath the image path
 * @param action the action
 */
private void addtoolbarAction(ToolBarManager toolBarManager, final ImagePathConstant imagePath, Action action) {

	ImageDescriptor exportImageDescriptor = new ImageDescriptor() {
		@Override
		public ImageData getImageData() {
			return imagePath.getImageFromRegistry().getImageData();
		}
	};
	action.setImageDescriptor(exportImageDescriptor);
	toolBarManager.add(action);
}
 
Example 29
Project: solidity-ide   File: CustomCSSHelpHoverProvider.java   View source code 5 votes vote down vote up
protected void configureControl(
		IXtextBrowserInformationControl control, ToolBarManager tbm,
		String font) {
	OpenInHelpAction openHelpAction = new OpenInHelpAction();
	openHelpAction.setEnabled(true);
	tbm.add(openHelpAction);
	tbm.update(true);
}
 
Example 30
Project: avro-schema-editor   File: StudioToolBarConfigurationImpl.java   View source code 5 votes vote down vote up
@Override
public void fillToolBar(ToolBarManager manager, String toolBarId) {
	if (TOP_TOOLBAR_ID.equals(toolBarId)) {
		fillTopToolBar(manager);
	} else if (toolBarId.equals(getToolBarId(Kind.EDITION))) {
		fillEditionToolBar(manager);
	}
}
 
Example 31
Project: avro-schema-editor   File: SchemaViewer.java   View source code 5 votes vote down vote up
protected ToolBarManager createToolBar(Composite parent, int style) {
	ToolBarManager toolbarManager = new ToolBarManager(style);
	
	int gridDataStyle = isBeginning(style) ? GridData.HORIZONTAL_ALIGN_BEGINNING : GridData.HORIZONTAL_ALIGN_END;
	
       ToolBar toolbar = toolbarManager.createControl(parent);
       GridData toolbarLayoutdata = new GridData(gridDataStyle);
       toolbarLayoutdata.heightHint = 25;
       toolbar.setLayoutData(toolbarLayoutdata);
       
	return toolbarManager;
}
 
Example 32
Project: avro-schema-editor   File: SchemaToolBarConfigurationImpl.java   View source code 5 votes vote down vote up
@Override
public void fillToolBar(ToolBarManager manager, String toolBarId) {
	Kind toolBarKind = getToolBarKind(toolBarId);
	if (toolBarKind != null) {
		fillToolBar(manager, toolBarKind);
	}
}
 
Example 33
Project: avro-schema-editor   File: SchemaToolBarConfigurationImpl.java   View source code 5 votes vote down vote up
protected void fillToolBar(ToolBarManager manager, Kind toolBarKind) {
	switch (toolBarKind) {
	case EDITION:
		fillEditionToolBar(manager);
		break;
	default:
		populateToolBar(manager, getToolBarId(toolBarKind));
		break;
	}
}
 
Example 34
Project: DarwinSPL   File: DwprofileTextHover.java   View source code 5 votes vote down vote up
public IInformationControl doCreateInformationControl(Shell parent) {
	if (de.darwinspl.preferences.resource.dwprofile.ui.DwprofileBrowserInformationControl.isAvailable(parent)) {
		ToolBarManager tbm = new ToolBarManager(SWT.FLAT);
		de.darwinspl.preferences.resource.dwprofile.ui.DwprofileBrowserInformationControl iControl = new de.darwinspl.preferences.resource.dwprofile.ui.DwprofileBrowserInformationControl(parent, FONT, tbm);
		final OpenDeclarationAction openDeclarationAction = new OpenDeclarationAction(iControl);
		tbm.add(openDeclarationAction);
		final SimpleSelectionProvider selectionProvider = new SimpleSelectionProvider();
		
		IInputChangedListener inputChangeListener = new IInputChangedListener() {
			public void inputChanged(Object newInput) {
				if (newInput == null) {
					selectionProvider.setSelection(new StructuredSelection());
				} else if (newInput instanceof de.darwinspl.preferences.resource.dwprofile.ui.DwprofileDocBrowserInformationControlInput) {
					de.darwinspl.preferences.resource.dwprofile.ui.DwprofileDocBrowserInformationControlInput input = (de.darwinspl.preferences.resource.dwprofile.ui.DwprofileDocBrowserInformationControlInput) newInput;
					Object inputElement = input.getInputElement();
					selectionProvider.setSelection(new StructuredSelection(inputElement));
					// If there is an element of type EObject in the input element, the button to open
					// the declaration will be set enable
					boolean isEObjectInput = inputElement instanceof EObject;
					openDeclarationAction.setEnabled(isEObjectInput);
					if (isEObjectInput) {
						String simpleName = inputElement.getClass().getSimpleName();
						simpleName = simpleName.substring(0, simpleName.length() - 4);
						openDeclarationAction.setText("Open " + simpleName);
					} else							openDeclarationAction.setText("Open Declaration");
				}
			}
		};
		iControl.addInputChangeListener(inputChangeListener);
		
		tbm.update(true);
		return iControl;
	} else {
		return new DefaultInformationControl(parent, true);
	}
}
 
Example 35
Project: DarwinSPL   File: HyexpressionTextHover.java   View source code 5 votes vote down vote up
public IInformationControl doCreateInformationControl(Shell parent) {
	if (eu.hyvar.feature.expression.resource.hyexpression.ui.HyexpressionBrowserInformationControl.isAvailable(parent)) {
		ToolBarManager tbm = new ToolBarManager(SWT.FLAT);
		eu.hyvar.feature.expression.resource.hyexpression.ui.HyexpressionBrowserInformationControl iControl = new eu.hyvar.feature.expression.resource.hyexpression.ui.HyexpressionBrowserInformationControl(parent, FONT, tbm);
		final OpenDeclarationAction openDeclarationAction = new OpenDeclarationAction(iControl);
		tbm.add(openDeclarationAction);
		final SimpleSelectionProvider selectionProvider = new SimpleSelectionProvider();
		
		IInputChangedListener inputChangeListener = new IInputChangedListener() {
			public void inputChanged(Object newInput) {
				if (newInput == null) {
					selectionProvider.setSelection(new StructuredSelection());
				} else if (newInput instanceof eu.hyvar.feature.expression.resource.hyexpression.ui.HyexpressionDocBrowserInformationControlInput) {
					eu.hyvar.feature.expression.resource.hyexpression.ui.HyexpressionDocBrowserInformationControlInput input = (eu.hyvar.feature.expression.resource.hyexpression.ui.HyexpressionDocBrowserInformationControlInput) newInput;
					Object inputElement = input.getInputElement();
					selectionProvider.setSelection(new StructuredSelection(inputElement));
					// If there is an element of type EObject in the input element, the button to open
					// the declaration will be set enable
					boolean isEObjectInput = inputElement instanceof EObject;
					openDeclarationAction.setEnabled(isEObjectInput);
					if (isEObjectInput) {
						String simpleName = inputElement.getClass().getSimpleName();
						simpleName = simpleName.substring(0, simpleName.length() - 4);
						openDeclarationAction.setText("Open " + simpleName);
					} else							openDeclarationAction.setText("Open Declaration");
				}
			}
		};
		iControl.addInputChangeListener(inputChangeListener);
		
		tbm.update(true);
		return iControl;
	} else {
		return new DefaultInformationControl(parent, true);
	}
}
 
Example 36
Project: DarwinSPL   File: HyvalidityformulaTextHover.java   View source code 5 votes vote down vote up
public IInformationControl doCreateInformationControl(Shell parent) {
	if (eu.hyvar.context.contextValidity.resource.hyvalidityformula.ui.HyvalidityformulaBrowserInformationControl.isAvailable(parent)) {
		ToolBarManager tbm = new ToolBarManager(SWT.FLAT);
		eu.hyvar.context.contextValidity.resource.hyvalidityformula.ui.HyvalidityformulaBrowserInformationControl iControl = new eu.hyvar.context.contextValidity.resource.hyvalidityformula.ui.HyvalidityformulaBrowserInformationControl(parent, FONT, tbm);
		final OpenDeclarationAction openDeclarationAction = new OpenDeclarationAction(iControl);
		tbm.add(openDeclarationAction);
		final SimpleSelectionProvider selectionProvider = new SimpleSelectionProvider();
		
		IInputChangedListener inputChangeListener = new IInputChangedListener() {
			public void inputChanged(Object newInput) {
				if (newInput == null) {
					selectionProvider.setSelection(new StructuredSelection());
				} else if (newInput instanceof eu.hyvar.context.contextValidity.resource.hyvalidityformula.ui.HyvalidityformulaDocBrowserInformationControlInput) {
					eu.hyvar.context.contextValidity.resource.hyvalidityformula.ui.HyvalidityformulaDocBrowserInformationControlInput input = (eu.hyvar.context.contextValidity.resource.hyvalidityformula.ui.HyvalidityformulaDocBrowserInformationControlInput) newInput;
					Object inputElement = input.getInputElement();
					selectionProvider.setSelection(new StructuredSelection(inputElement));
					// If there is an element of type EObject in the input element, the button to open
					// the declaration will be set enable
					boolean isEObjectInput = inputElement instanceof EObject;
					openDeclarationAction.setEnabled(isEObjectInput);
					if (isEObjectInput) {
						String simpleName = inputElement.getClass().getSimpleName();
						simpleName = simpleName.substring(0, simpleName.length() - 4);
						openDeclarationAction.setText("Open " + simpleName);
					} else							openDeclarationAction.setText("Open Declaration");
				}
			}
		};
		iControl.addInputChangeListener(inputChangeListener);
		
		tbm.update(true);
		return iControl;
	} else {
		return new DefaultInformationControl(parent, true);
	}
}
 
Example 37
Project: DarwinSPL   File: HydatavalueTextHover.java   View source code 5 votes vote down vote up
public IInformationControl doCreateInformationControl(Shell parent) {
	if (eu.hyvar.dataValues.resource.hydatavalue.ui.HydatavalueBrowserInformationControl.isAvailable(parent)) {
		ToolBarManager tbm = new ToolBarManager(SWT.FLAT);
		eu.hyvar.dataValues.resource.hydatavalue.ui.HydatavalueBrowserInformationControl iControl = new eu.hyvar.dataValues.resource.hydatavalue.ui.HydatavalueBrowserInformationControl(parent, FONT, tbm);
		final OpenDeclarationAction openDeclarationAction = new OpenDeclarationAction(iControl);
		tbm.add(openDeclarationAction);
		final SimpleSelectionProvider selectionProvider = new SimpleSelectionProvider();
		
		IInputChangedListener inputChangeListener = new IInputChangedListener() {
			public void inputChanged(Object newInput) {
				if (newInput == null) {
					selectionProvider.setSelection(new StructuredSelection());
				} else if (newInput instanceof eu.hyvar.dataValues.resource.hydatavalue.ui.HydatavalueDocBrowserInformationControlInput) {
					eu.hyvar.dataValues.resource.hydatavalue.ui.HydatavalueDocBrowserInformationControlInput input = (eu.hyvar.dataValues.resource.hydatavalue.ui.HydatavalueDocBrowserInformationControlInput) newInput;
					Object inputElement = input.getInputElement();
					selectionProvider.setSelection(new StructuredSelection(inputElement));
					// If there is an element of type EObject in the input element, the button to open
					// the declaration will be set enable
					boolean isEObjectInput = inputElement instanceof EObject;
					openDeclarationAction.setEnabled(isEObjectInput);
					if (isEObjectInput) {
						String simpleName = inputElement.getClass().getSimpleName();
						simpleName = simpleName.substring(0, simpleName.length() - 4);
						openDeclarationAction.setText("Open " + simpleName);
					} else							openDeclarationAction.setText("Open Declaration");
				}
			}
		};
		iControl.addInputChangeListener(inputChangeListener);
		
		tbm.update(true);
		return iControl;
	} else {
		return new DefaultInformationControl(parent, true);
	}
}
 
Example 38
Project: DarwinSPL   File: HymappingTextHover.java   View source code 5 votes vote down vote up
public IInformationControl doCreateInformationControl(Shell parent) {
	if (eu.hyvar.feature.mapping.resource.hymapping.ui.HymappingBrowserInformationControl.isAvailable(parent)) {
		ToolBarManager tbm = new ToolBarManager(SWT.FLAT);
		eu.hyvar.feature.mapping.resource.hymapping.ui.HymappingBrowserInformationControl iControl = new eu.hyvar.feature.mapping.resource.hymapping.ui.HymappingBrowserInformationControl(parent, FONT, tbm);
		final OpenDeclarationAction openDeclarationAction = new OpenDeclarationAction(iControl);
		tbm.add(openDeclarationAction);
		final SimpleSelectionProvider selectionProvider = new SimpleSelectionProvider();
		
		IInputChangedListener inputChangeListener = new IInputChangedListener() {
			public void inputChanged(Object newInput) {
				if (newInput == null) {
					selectionProvider.setSelection(new StructuredSelection());
				} else if (newInput instanceof eu.hyvar.feature.mapping.resource.hymapping.ui.HymappingDocBrowserInformationControlInput) {
					eu.hyvar.feature.mapping.resource.hymapping.ui.HymappingDocBrowserInformationControlInput input = (eu.hyvar.feature.mapping.resource.hymapping.ui.HymappingDocBrowserInformationControlInput) newInput;
					Object inputElement = input.getInputElement();
					selectionProvider.setSelection(new StructuredSelection(inputElement));
					// If there is an element of type EObject in the input element, the button to open
					// the declaration will be set enable
					boolean isEObjectInput = inputElement instanceof EObject;
					openDeclarationAction.setEnabled(isEObjectInput);
					if (isEObjectInput) {
						String simpleName = inputElement.getClass().getSimpleName();
						simpleName = simpleName.substring(0, simpleName.length() - 4);
						openDeclarationAction.setText("Open " + simpleName);
					} else							openDeclarationAction.setText("Open Declaration");
				}
			}
		};
		iControl.addInputChangeListener(inputChangeListener);
		
		tbm.update(true);
		return iControl;
	} else {
		return new DefaultInformationControl(parent, true);
	}
}
 
Example 39
Project: DarwinSPL   File: HyconstraintsTextHover.java   View source code 5 votes vote down vote up
public IInformationControl doCreateInformationControl(Shell parent) {
	if (eu.hyvar.feature.constraint.resource.hyconstraints.ui.HyconstraintsBrowserInformationControl.isAvailable(parent)) {
		ToolBarManager tbm = new ToolBarManager(SWT.FLAT);
		eu.hyvar.feature.constraint.resource.hyconstraints.ui.HyconstraintsBrowserInformationControl iControl = new eu.hyvar.feature.constraint.resource.hyconstraints.ui.HyconstraintsBrowserInformationControl(parent, FONT, tbm);
		final OpenDeclarationAction openDeclarationAction = new OpenDeclarationAction(iControl);
		tbm.add(openDeclarationAction);
		final SimpleSelectionProvider selectionProvider = new SimpleSelectionProvider();
		
		IInputChangedListener inputChangeListener = new IInputChangedListener() {
			public void inputChanged(Object newInput) {
				if (newInput == null) {
					selectionProvider.setSelection(new StructuredSelection());
				} else if (newInput instanceof eu.hyvar.feature.constraint.resource.hyconstraints.ui.HyconstraintsDocBrowserInformationControlInput) {
					eu.hyvar.feature.constraint.resource.hyconstraints.ui.HyconstraintsDocBrowserInformationControlInput input = (eu.hyvar.feature.constraint.resource.hyconstraints.ui.HyconstraintsDocBrowserInformationControlInput) newInput;
					Object inputElement = input.getInputElement();
					selectionProvider.setSelection(new StructuredSelection(inputElement));
					// If there is an element of type EObject in the input element, the button to open
					// the declaration will be set enable
					boolean isEObjectInput = inputElement instanceof EObject;
					openDeclarationAction.setEnabled(isEObjectInput);
					if (isEObjectInput) {
						String simpleName = inputElement.getClass().getSimpleName();
						simpleName = simpleName.substring(0, simpleName.length() - 4);
						openDeclarationAction.setText("Open " + simpleName);
					} else							openDeclarationAction.setText("Open Declaration");
				}
			}
		};
		iControl.addInputChangeListener(inputChangeListener);
		
		tbm.update(true);
		return iControl;
	} else {
		return new DefaultInformationControl(parent, true);
	}
}
 
Example 40
Project: DarwinSPL   File: HymanifestTextHover.java   View source code 5 votes vote down vote up
public IInformationControl doCreateInformationControl(Shell parent) {
	if (eu.hyvar.mspl.manifest.resource.hymanifest.ui.HymanifestBrowserInformationControl.isAvailable(parent)) {
		ToolBarManager tbm = new ToolBarManager(SWT.FLAT);
		eu.hyvar.mspl.manifest.resource.hymanifest.ui.HymanifestBrowserInformationControl iControl = new eu.hyvar.mspl.manifest.resource.hymanifest.ui.HymanifestBrowserInformationControl(parent, FONT, tbm);
		final OpenDeclarationAction openDeclarationAction = new OpenDeclarationAction(iControl);
		tbm.add(openDeclarationAction);
		final SimpleSelectionProvider selectionProvider = new SimpleSelectionProvider();
		
		IInputChangedListener inputChangeListener = new IInputChangedListener() {
			public void inputChanged(Object newInput) {
				if (newInput == null) {
					selectionProvider.setSelection(new StructuredSelection());
				} else if (newInput instanceof eu.hyvar.mspl.manifest.resource.hymanifest.ui.HymanifestDocBrowserInformationControlInput) {
					eu.hyvar.mspl.manifest.resource.hymanifest.ui.HymanifestDocBrowserInformationControlInput input = (eu.hyvar.mspl.manifest.resource.hymanifest.ui.HymanifestDocBrowserInformationControlInput) newInput;
					Object inputElement = input.getInputElement();
					selectionProvider.setSelection(new StructuredSelection(inputElement));
					// If there is an element of type EObject in the input element, the button to open
					// the declaration will be set enable
					boolean isEObjectInput = inputElement instanceof EObject;
					openDeclarationAction.setEnabled(isEObjectInput);
					if (isEObjectInput) {
						String simpleName = inputElement.getClass().getSimpleName();
						simpleName = simpleName.substring(0, simpleName.length() - 4);
						openDeclarationAction.setText("Open " + simpleName);
					} else							openDeclarationAction.setText("Open Declaration");
				}
			}
		};
		iControl.addInputChangeListener(inputChangeListener);
		
		tbm.update(true);
		return iControl;
	} else {
		return new DefaultInformationControl(parent, true);
	}
}