Java Code Examples for org.eclipse.jface.resource.JFaceResources#getDialogFont()

The following examples show how to use org.eclipse.jface.resource.JFaceResources#getDialogFont() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractOpenWizardAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void run() {
	Shell shell= getShell();
	if (!doCreateProjectFirstOnEmptyWorkspace(shell)) {
		return;
	}
	try {
		INewWizard wizard= createWizard();
		wizard.init(PlatformUI.getWorkbench(), getSelection());

		WizardDialog dialog= new WizardDialog(shell, wizard);
		PixelConverter converter= new PixelConverter(JFaceResources.getDialogFont());
		dialog.setMinimumPageSize(converter.convertWidthInCharsToPixels(70), converter.convertHeightInCharsToPixels(20));
		dialog.create();
		int res= dialog.open();
		if (res == Window.OK && wizard instanceof NewElementWizard) {
			fCreatedElement= ((NewElementWizard)wizard).getCreatedElement();
		}

		notifyResult(res == Window.OK);
	} catch (CoreException e) {
		String title= NewWizardMessages.AbstractOpenWizardAction_createerror_title;
		String message= NewWizardMessages.AbstractOpenWizardAction_createerror_message;
		ExceptionHandler.handle(e, shell, title, message);
	}
}
 
Example 2
Source File: CustomBrowserInformationControl.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
public Point computeSizeConstraints(int widthInChars, int heightInChars)
{
	if (fSymbolicFontName == null)
		return null;

	GC gc = new GC(fBrowser);
	Font font = fSymbolicFontName == null ? JFaceResources.getDialogFont() : JFaceResources
			.getFont(fSymbolicFontName);
	gc.setFont(font);
	int width = gc.getFontMetrics().getAverageCharWidth();
	int height = gc.getFontMetrics().getHeight();
	gc.dispose();

	return new Point(widthInChars * width, heightInChars * height);
}
 
Example 3
Source File: CreateTargetQueries.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private IWizardPage[] openNewElementWizard(IWorkbenchWizard wizard, Shell shell, Object selection) {
	wizard.init(JavaPlugin.getDefault().getWorkbench(), new StructuredSelection(selection));

	WizardDialog dialog= new WizardDialog(shell, wizard);
	PixelConverter converter= new PixelConverter(JFaceResources.getDialogFont());
	dialog.setMinimumPageSize(converter.convertWidthInCharsToPixels(70), converter.convertHeightInCharsToPixels(20));
	dialog.create();
	dialog.open();
	IWizardPage[] pages= wizard.getPages();
	return pages;
}
 
Example 4
Source File: JavadocWizard.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public static void openJavadocWizard(JavadocWizard wizard, Shell shell, IStructuredSelection selection ) {
	wizard.init(PlatformUI.getWorkbench(), selection);

	WizardDialog dialog= new WizardDialog(shell, wizard) {
		@Override
		protected IDialogSettings getDialogBoundsSettings() {
			// added so that the wizard can remember the last used size
			return JavaPlugin.getDefault().getDialogSettingsSection("JavadocWizardDialog"); //$NON-NLS-1$
		}
	};
	PixelConverter converter= new PixelConverter(JFaceResources.getDialogFont());
	dialog.setMinimumPageSize(converter.convertWidthInCharsToPixels(100), converter.convertHeightInCharsToPixels(20));
	dialog.open();
}
 
Example 5
Source File: ClasspathContainerWizard.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public static int openWizard(Shell shell, ClasspathContainerWizard wizard) {
	WizardDialog dialog= new WizardDialog(shell, wizard);
	PixelConverter converter= new PixelConverter(JFaceResources.getDialogFont());
	dialog.setMinimumPageSize(converter.convertWidthInCharsToPixels(70), converter.convertHeightInCharsToPixels(20));
	dialog.create();
	return dialog.open();
}
 
Example 6
Source File: EditFilterAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void run() {
	Shell shell= getShell();

	try {
		EditFilterWizard wizard= createWizard();
		wizard.init(PlatformUI.getWorkbench(), new StructuredSelection(getSelectedElements().get(0)));

		WizardDialog dialog= new WizardDialog(shell, wizard);
		PixelConverter converter= new PixelConverter(JFaceResources.getDialogFont());
		dialog.setMinimumPageSize(converter.convertWidthInCharsToPixels(70), converter.convertHeightInCharsToPixels(20));
		dialog.create();
		int res= dialog.open();
		if (res == Window.OK) {
			BuildpathDelta delta= new BuildpathDelta(getToolTipText());

			ArrayList<CPListElement> newEntries= wizard.getExistingEntries();
			delta.setNewEntries(newEntries.toArray(new CPListElement[newEntries.size()]));

			IResource resource= wizard.getCreatedElement().getCorrespondingResource();
			delta.addCreatedResource(resource);

			delta.setDefaultOutputLocation(wizard.getOutputLocation());

			informListeners(delta);

			selectAndReveal(new StructuredSelection(wizard.getCreatedElement()));
		}

		notifyResult(res == Window.OK);
	} catch (CoreException e) {
		String title= NewWizardMessages.AbstractOpenWizardAction_createerror_title;
		String message= NewWizardMessages.AbstractOpenWizardAction_createerror_message;
		ExceptionHandler.handle(e, shell, title, message);
	}
}
 
Example 7
Source File: CordovaPluginWizardResources.java    From thym with Eclipse Public License 1.0 5 votes vote down vote up
private FontDescriptor createFontDescriptor(int style, float heightMultiplier) {
	Font baseFont = JFaceResources.getDialogFont();
	FontData[] fontData = baseFont.getFontData();
	FontData[] newFontData = new FontData[fontData.length];
	for (int i = 0; i < newFontData.length; i++) {
		newFontData[i] = new FontData(fontData[i].getName(), (int) (fontData[i].getHeight() * heightMultiplier), fontData[i].getStyle() | style);
	}
	return FontDescriptor.createFrom(newFontData);
}
 
Example 8
Source File: GeneralPage.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public void refresh( )
{
	if ( input instanceof List
			&& DEUtil.getMultiSelectionHandle( (List) input )
					.isExtendedElements( ) )
	{

		librarySection.setHidden( false );


		if ( hasLocalProperties( ) )
		{

			noteSection.setHidden( false );
			Font font = JFaceResources.getDialogFont( );
			FontData fData = font.getFontData( )[0];
			fData.setHeight( fData.getHeight( ) - 1 );
			noteSection.getTextControl( )
					.setFont( FontManager.getFont( fData ) );
		}
		else
			noteSection.setHidden( true );

		seperatorSection.setHidden( false );
		librarySection.load( );
	}
	else
	{
		librarySection.setHidden( true );
		noteSection.setHidden( true );
		seperatorSection.setHidden( true );
	}
	super.refresh( );
	container.layout( true );
	container.redraw( );

}
 
Example 9
Source File: CreateLinkedSourceFolderAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void run() {
	Shell shell= getShell();

	try {
		IJavaProject javaProject= (IJavaProject)getSelectedElements().get(0);

		CPListElement newEntrie= new CPListElement(javaProject, IClasspathEntry.CPE_SOURCE);
           CPListElement[] existing= CPListElement.createFromExisting(javaProject);
           boolean isProjectSrcFolder= CPListElement.isProjectSourceFolder(existing, javaProject);

		AddSourceFolderWizard wizard= new AddSourceFolderWizard(existing, newEntrie, getOutputLocation(javaProject), true, false, false, isProjectSrcFolder, isProjectSrcFolder);
		wizard.init(PlatformUI.getWorkbench(), new StructuredSelection(javaProject));

		WizardDialog dialog= new WizardDialog(shell, wizard);
		PixelConverter converter= new PixelConverter(JFaceResources.getDialogFont());
		dialog.setMinimumPageSize(converter.convertWidthInCharsToPixels(70), converter.convertHeightInCharsToPixels(20));
		dialog.create();
		int res= dialog.open();
		if (res == Window.OK) {

			BuildpathDelta delta= new BuildpathDelta(getToolTipText());

			ArrayList<CPListElement> newEntries= wizard.getExistingEntries();
			delta.setNewEntries(newEntries.toArray(new CPListElement[newEntries.size()]));

			IResource resource= wizard.getCreatedElement().getCorrespondingResource();
			delta.addCreatedResource(resource);

			delta.setDefaultOutputLocation(wizard.getOutputLocation());

			informListeners(delta);

			selectAndReveal(new StructuredSelection(wizard.getCreatedElement()));
		}

		notifyResult(res == Window.OK);
	} catch (CoreException e) {
		String title= NewWizardMessages.AbstractOpenWizardAction_createerror_title;
		String message= NewWizardMessages.AbstractOpenWizardAction_createerror_message;
		ExceptionHandler.handle(e, shell, title, message);
	}
}
 
Example 10
Source File: CreateSourceFolderAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void run() {
	Shell shell= getShell();

	try {
		IJavaProject javaProject= (IJavaProject)getSelectedElements().get(0);

           CPListElement newEntrie= new CPListElement(javaProject, IClasspathEntry.CPE_SOURCE);
           CPListElement[] existing= CPListElement.createFromExisting(javaProject);
           boolean isProjectSrcFolder= CPListElement.isProjectSourceFolder(existing, javaProject);

           AddSourceFolderWizard wizard= new AddSourceFolderWizard(existing, newEntrie, getOutputLocation(javaProject), false, false, false, isProjectSrcFolder, isProjectSrcFolder);
		wizard.init(PlatformUI.getWorkbench(), new StructuredSelection(javaProject));

		WizardDialog dialog= new WizardDialog(shell, wizard);
		PixelConverter converter= new PixelConverter(JFaceResources.getDialogFont());
		dialog.setMinimumPageSize(converter.convertWidthInCharsToPixels(70), converter.convertHeightInCharsToPixels(20));
		dialog.create();
		int res= dialog.open();
		if (res == Window.OK) {
			BuildpathDelta delta= new BuildpathDelta(getToolTipText());

			ArrayList<CPListElement> newEntries= wizard.getExistingEntries();
			delta.setNewEntries(newEntries.toArray(new CPListElement[newEntries.size()]));

			IResource resource= wizard.getCreatedElement().getCorrespondingResource();
			delta.addCreatedResource(resource);

			delta.setDefaultOutputLocation(wizard.getOutputLocation());

			informListeners(delta);

			selectAndReveal(new StructuredSelection(wizard.getCreatedElement()));
		}

		notifyResult(res == Window.OK);
	} catch (CoreException e) {
		String title= NewWizardMessages.AbstractOpenWizardAction_createerror_title;
		String message= NewWizardMessages.AbstractOpenWizardAction_createerror_message;
		ExceptionHandler.handle(e, shell, title, message);
	}
}