Java Code Examples for org.eclipse.swt.widgets.Link#setLayoutData()

The following examples show how to use org.eclipse.swt.widgets.Link#setLayoutData() . 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: GenerateConstructorUsingFieldsSelectionDialog.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected Control createLinkControl(Composite composite) {
	Link link= new Link(composite, SWT.WRAP);
	link.setText(ActionMessages.GenerateConstructorUsingFieldsSelectionDialog_template_link_message);
	link.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			openCodeTempatePage(CodeTemplateContextType.CONSTRUCTORCOMMENT_ID);
		}
	});
	link.setToolTipText(ActionMessages.GenerateConstructorUsingFieldsSelectionDialog_template_link_tooltip);

	GridData gridData= new GridData(SWT.FILL, SWT.BEGINNING, true, false);
	gridData.widthHint= convertWidthInCharsToPixels(40); // only expand further if anyone else requires it
	link.setLayoutData(gridData);
	return link;
}
 
Example 2
Source File: SyntaxColoringPreferencePage.java    From editorconfig-eclipse with Apache License 2.0 6 votes vote down vote up
private void createHeader(Composite contents) {
	String text = PreferencesMessages.EditorConfigEditorPreferencePage_link;
	Link link = new Link(contents, SWT.NONE);
	link.setText(text);
	link.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			if ("org.eclipse.ui.preferencePages.GeneralTextEditor".equals(e.text)) //$NON-NLS-1$
				PreferencesUtil.createPreferenceDialogOn(getShell(), e.text, null, null);
			else if ("org.eclipse.ui.preferencePages.ColorsAndFonts".equals(e.text)) //$NON-NLS-1$
				PreferencesUtil.createPreferenceDialogOn(getShell(), e.text, null,
						"selectFont:org.eclipse.jdt.ui.EditorConfigEditor.textfont"); //$NON-NLS-1$
		}
	});

	GridData gridData = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
	gridData.widthHint = 150; // only expand further if anyone else requires
								// it
	link.setLayoutData(gridData);

	addFiller(contents);
}
 
Example 3
Source File: NewJavaProjectWizardPageOne.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
public Control createContent(Composite composite) {
	fGroup= new Group(composite, SWT.NONE);
	fGroup.setFont(composite.getFont());
	fGroup.setLayout(initGridLayout(new GridLayout(3, false), true));
	fGroup.setText(NewWizardMessages.NewJavaProjectWizardPageOne_LayoutGroup_title);

	fStdRadio.doFillIntoGrid(fGroup, 3);
	LayoutUtil.setHorizontalGrabbing(fStdRadio.getSelectionButton(null));

	fSrcBinRadio.doFillIntoGrid(fGroup, 2);

	fPreferenceLink= new Link(fGroup, SWT.NONE);
	fPreferenceLink.setText(NewWizardMessages.NewJavaProjectWizardPageOne_LayoutGroup_link_description);
	fPreferenceLink.setLayoutData(new GridData(GridData.END, GridData.END, false, false));
	fPreferenceLink.addSelectionListener(this);

	updateEnableState();
	return fGroup;
}
 
Example 4
Source File: NewJavaProjectWizardPageOne.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
public Control createControl(Composite composite) {
	fGroup= new Group(composite, SWT.NONE);
	fGroup.setFont(composite.getFont());
	fGroup.setLayout(initGridLayout(new GridLayout(2, false), true));
	fGroup.setText(NewWizardMessages.NewJavaProjectWizardPageOne_JREGroup_title);

	fUseEEJRE.doFillIntoGrid(fGroup, 1);
	Combo eeComboControl= fEECombo.getComboControl(fGroup);
	eeComboControl.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
	
	fUseProjectJRE.doFillIntoGrid(fGroup, 1);
	Combo comboControl= fJRECombo.getComboControl(fGroup);
	comboControl.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));

	fUseDefaultJRE.doFillIntoGrid(fGroup, 1);

	fPreferenceLink= new Link(fGroup, SWT.NONE);
	fPreferenceLink.setFont(fGroup.getFont());
	fPreferenceLink.setText(NewWizardMessages.NewJavaProjectWizardPageOne_JREGroup_link_description);
	fPreferenceLink.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));
	fPreferenceLink.addSelectionListener(this);

	updateEnableState();
	return fGroup;
}
 
Example 5
Source File: DialogAbout.java    From arx with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a link.
 *
 * @param parent
 * @param text
 * @param tooltip
 * @param url
 */
private void createLink(Composite parent, String text, String tooltip, final String url){
    Link link = new Link(parent, SWT.NONE);
    link.setLayoutData(SWTUtil.createFillHorizontallyGridData());
    link.setText(text);
    link.setToolTipText(tooltip);
    link.setBackground(parent.getBackground());
    link.addListener (SWT.Selection, new Listener () {
        public void handleEvent(Event event) {
            try {
                Program.launch(url);
            } catch (Exception e){
                /* Ignore*/
            }
        }
    });
}
 
Example 6
Source File: OptionsConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
protected Link addLink(Composite parent, String label, Key key, SelectionListener linkListener, int indent, int widthHint) {
	GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL);
	gd.horizontalSpan= 3;
	gd.horizontalIndent= indent;
	gd.widthHint= widthHint;

	Link link= new Link(parent, SWT.NONE);
	link.setFont(JFaceResources.getDialogFont());
	link.setText(label);
	link.setData(key);
	link.setLayoutData(gd);
	link.addSelectionListener(linkListener);

	makeScrollableCompositeAware(link);

	fLinks.add(link);

	return link;
}
 
Example 7
Source File: JavaEditorAppearanceConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private void createHeader(Composite contents) {
	final Shell shell= contents.getShell();
	String text= PreferencesMessages.JavaEditorPreferencePage_link;
	Link link= new Link(contents, SWT.NONE);
	link.setText(text);
	link.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			if ("org.eclipse.ui.preferencePages.GeneralTextEditor".equals(e.text)) //$NON-NLS-1$
				PreferencesUtil.createPreferenceDialogOn(shell, e.text, null, null);
			else if ("org.eclipse.ui.preferencePages.ColorsAndFonts".equals(e.text)) //$NON-NLS-1$
				PreferencesUtil.createPreferenceDialogOn(shell, e.text, null, "selectFont:org.eclipse.jdt.ui.editors.textfont"); //$NON-NLS-1$
		}
	});

	GridData gridData= new GridData(SWT.FILL, SWT.BEGINNING, true, false);
	gridData.widthHint= 150; // only expand further if anyone else requires it
	link.setLayoutData(gridData);

	addFiller(contents);
}
 
Example 8
Source File: AddUnimplementedConstructorsAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected Control createLinkControl(Composite composite) {
	Link link= new Link(composite, SWT.WRAP);
	link.setText(ActionMessages.AddUnimplementedConstructorsAction_template_link_message);
	link.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			openCodeTempatePage(CodeTemplateContextType.CONSTRUCTORCOMMENT_ID);
		}
	});
	link.setToolTipText(ActionMessages.AddUnimplementedConstructorsAction_template_link_tooltip);

	GridData gridData= new GridData(SWT.FILL, SWT.BEGINNING, true, false);
	gridData.widthHint= convertWidthInCharsToPixels(40); // only expand further if anyone else requires it
	link.setLayoutData(gridData);
	return link;
}
 
Example 9
Source File: AddGetterSetterAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected Control createLinkControl(Composite composite) {
	Link link= new Link(composite, SWT.WRAP);
	link.setText(ActionMessages.AddGetterSetterAction_template_link_description);
	link.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			openCodeTempatePage(CodeTemplateContextType.GETTERCOMMENT_ID);
		}
	});
	link.setToolTipText(ActionMessages.AddGetterSetterAction_template_link_tooltip);

	GridData gridData= new GridData(SWT.FILL, SWT.BEGINNING, true, false);
	gridData.widthHint= convertWidthInCharsToPixels(40); // only expand further if anyone else requires it
	link.setLayoutData(gridData);
	return link;
}
 
Example 10
Source File: CloudSdkUpdateNotification.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
@Override
protected void createContentArea(Composite parent) {
  Link message = new Link(parent, SWT.WRAP);
  message.setText(Messages.getString("CloudSdkUpdateNotificationMessage", sdkVersion));
  message.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
  message.addSelectionListener(
      new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent event) {
          linkSelected(event.text);
        }
      });
}
 
Example 11
Source File: BusinessDataViewer.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private Composite createEmptyBDMComposite(Composite parent) {
    Composite client = widgetFactory.createComposite(parent);
    client.setLayout(GridLayoutFactory.fillDefaults().create());
    client.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());

    Composite emptyBDMComposite = widgetFactory.createComposite(client);
    emptyBDMComposite.setLayout(GridLayoutFactory.fillDefaults().create());
    emptyBDMComposite
            .setLayoutData(GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.CENTER).grab(true, true).create());

    final ImageHyperlink imageHyperlink = widgetFactory.createImageHyperlink(emptyBDMComposite, SWT.NO_FOCUS);
    imageHyperlink.setLayoutData(GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.FILL).create());
    imageHyperlink.setImage(Pics.getImage("defineBdm_60.png", DataPlugin.getDefault()));
    imageHyperlink.addHyperlinkListener(new HyperlinkAdapter() {

        @Override
        public void linkActivated(HyperlinkEvent e) {
            commandExecutor.executeCommand(DEFINE_BDM_COMMAND, null);
        }
    });

    Link labelLink = new Link(emptyBDMComposite, SWT.NO_FOCUS);
    widgetFactory.adapt(labelLink, false, false);
    labelLink.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).align(SWT.FILL, SWT.CENTER).create());
    labelLink.setText(Messages.defineBdmTooltip);
    labelLink.addListener(SWT.Selection, e -> commandExecutor.executeCommand(DEFINE_BDM_COMMAND, null));

    return client;
}
 
Example 12
Source File: SWTFactory.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates a new link widget
 * @param parent the parent composite to add this link widget to
 * @param text the text for the link
 * @param hspan the horizontal span to take up in the parent composite
 * @return the new link
 */
public static Link createLink(Composite parent, String text, int hspan, SelectionAdapter listener) {
    Link l = new Link(parent, SWT.NONE);
    l.setFont(parent.getFont());
    l.setText(text);
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = hspan;
    gd.grabExcessHorizontalSpace = false;
    l.setLayoutData(gd);
    l.addSelectionListener(listener);
    return l;
}
 
Example 13
Source File: CheckBoxExpressionViewer.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private void createSwitchEditorControl(final TabbedPropertySheetWidgetFactory widgetFactory) {
    ((GridLayout) control.getLayout()).numColumns++;
    final Link switchControl = new Link(mc, SWT.NONE);
    switchControl.setLayoutData(GridDataFactory.fillDefaults().indent(15, 0).create());
    switchControl.setText(Messages.switchEditorCondition);
    switchControl.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent e) {
            switchEditorType();
        }
    });
}
 
Example 14
Source File: CompletionProposalComputerRegistry.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Log the status and inform the user about a misbehaving extension.
 *
 * @param descriptor the descriptor of the misbehaving extension
 * @param status a status object that will be logged
 */
void informUser(CompletionProposalComputerDescriptor descriptor, IStatus status) {
	JavaPlugin.log(status);
       String title= JavaTextMessages.CompletionProposalComputerRegistry_error_dialog_title;
       CompletionProposalCategory category= descriptor.getCategory();
       IContributor culprit= descriptor.getContributor();
       Set<String> affectedPlugins= getAffectedContributors(category, culprit);

	final String avoidHint;
	final String culpritName= culprit == null ? null : culprit.getName();
	if (affectedPlugins.isEmpty())
		avoidHint= Messages.format(JavaTextMessages.CompletionProposalComputerRegistry_messageAvoidanceHint, new Object[] {culpritName, category.getDisplayName()});
	else
		avoidHint= Messages.format(JavaTextMessages.CompletionProposalComputerRegistry_messageAvoidanceHintWithWarning, new Object[] {culpritName, category.getDisplayName(), toString(affectedPlugins)});

	String message= status.getMessage();
       // inlined from MessageDialog.openError
       MessageDialog dialog = new MessageDialog(JavaPlugin.getActiveWorkbenchShell(), title, null /* default image */, message, MessageDialog.ERROR, new String[] { IDialogConstants.OK_LABEL }, 0) {
       	@Override
		protected Control createCustomArea(Composite parent) {
       		Link link= new Link(parent, SWT.NONE);
       		link.setText(avoidHint);
       		link.addSelectionListener(new SelectionAdapter() {
       			@Override
				public void widgetSelected(SelectionEvent e) {
       				PreferencesUtil.createPreferenceDialogOn(getShell(), "org.eclipse.jdt.ui.preferences.CodeAssistPreferenceAdvanced", null, null).open(); //$NON-NLS-1$
       			}
       		});
       		GridData gridData= new GridData(SWT.FILL, SWT.BEGINNING, true, false);
       		gridData.widthHint= this.getMinimumMessageWidth();
			link.setLayoutData(gridData);
       		return link;
       	}
       };
       dialog.open();
}
 
Example 15
Source File: HyperlinkInfoPopupDialog.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
protected Control createDialogArea(Composite parent)
{
	Composite main = new Composite(parent, SWT.NONE);
	main.setLayout(GridLayoutFactory.swtDefaults().create());
	main.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());

	Link infoLabel = new Link(main, SWT.WRAP);
	infoLabel.setText(message);
	infoLabel.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
	infoLabel.addSelectionListener(selectionListener);
	return main;
}
 
Example 16
Source File: BrowserEnvironmentWarningDialog.java    From hop with Apache License 2.0 5 votes vote down vote up
private void setHelpLink( Display display, String helpLink, int maxTextWidth, EnvironmentCase environment ) {
  link = new Link( shell, SWT.SINGLE | SWT.WRAP );
  link.setText( helpLink );
  if ( environment == EnvironmentCase.MAC_OS_X || environment == EnvironmentCase.MAC_OS_X_THIN ) {
    FontData[] fD = link.getFont().getFontData();
    fD[ 0 ].setHeight( 13 );
    link.setFont( new Font( display, fD[ 0 ] ) );
  }
  FormData fdlink = new FormData();
  fdlink.left = new FormAttachment( warningIcon, margin ); // Link should be below description right of icon
  fdlink.top = new FormAttachment( description, margin );
  fdlink.width = maxTextWidth;
  link.setLayoutData( fdlink );
  props.setLook( link );

  link.addListener( SWT.Selection, new Listener() {
    public void handleEvent( Event event ) {
      if ( Desktop.isDesktopSupported() ) {
        try {
          Desktop.getDesktop().browse( new URI( Const.getDocUrl( URI_PATH ) ) );
        } catch ( Exception e ) {
          log.logError( "Error opening external browser", e );
        }
      }
    }
  } );
}
 
Example 17
Source File: ChromeExecutableTab.java    From wildwebdeveloper with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void createControl(Composite parent) {
	Composite res = new Composite(parent, SWT.NONE);
	res.setLayout(new GridLayout(2, false));

	new Label(res, SWT.NONE).setText(Messages.ChromeAttachTab_runWith);
	browserToUse = new ComboViewer(res, SWT.VERTICAL | SWT.DROP_DOWN | SWT.BORDER | SWT.READ_ONLY);
	browserToUse.setContentProvider(new ArrayContentProvider());
	browserToUse.setLabelProvider(new BrowserLabelProvider());
	proposals = new LinkedList<>();
	proposals.add(""); //$NON-NLS-1$
	proposals.addAll(BrowserManager.getInstance().getWebBrowsers().stream().filter(ChromeExecutableTab::isChrome).collect(Collectors.toList()));
	browserToUse.setInput(proposals);
	browserToUse.addPostSelectionChangedListener(e -> {
		setDirty(true);
		updateLaunchConfigurationDialog();
	});

	Link link = new Link(res, SWT.NONE);
	link.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false, 2, 1));
	link.setText(Messages.ChromeAttachTab_browserPreferences);
	link.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> {
		Dialog dialog = PreferencesUtil.createPreferenceDialogOn(link.getShell(), "org.eclipse.ui.browser.preferencePage", null, null); //$NON-NLS-1$
		dialog.open();
		List<IBrowserDescriptor> previous = proposals.stream().filter(IBrowserDescriptor.class::isInstance).map(IBrowserDescriptor.class::cast).collect(Collectors.toList());
		List<IBrowserDescriptor> next = BrowserManager.getInstance().getWebBrowsers();
		List<IBrowserDescriptor> toRemove = new LinkedList<>(previous);
		toRemove.removeAll(next);
		proposals.removeAll(toRemove);
		List<IBrowserDescriptor> toAdd = new LinkedList<>(next);
		toAdd.removeAll(previous);
		toAdd.removeIf(browser -> !isChrome(browser));
		proposals.addAll(toAdd);
		if (!(toAdd.isEmpty() && toRemove.isEmpty())) {
			browserToUse.refresh();
			if (browserToUse.getSelection().isEmpty()) {
				browserToUse.setSelection(new StructuredSelection("")); //$NON-NLS-1$
			}
		}
	}));
	
	setControl(res);
}
 
Example 18
Source File: CompilationUnitEditor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Opens a warning dialog informing about a failure during handling of save listeners.
 *
 * @param title the dialog title
 * @param message the message to display
 * @param exception the exception to handle
 * @since 3.4
 */
private void openSaveListenerWarningDialog(String title, String message, CoreException exception) {
	final String linkText;
	final IJavaProject javaProject= getInputJavaElement().getJavaProject();
	IProject project= javaProject != null ? javaProject.getProject() : null;
	final boolean hasProjectSettings= project != null && CleanUpPreferenceUtil.hasSettingsInScope(new ProjectScope(project));
	if (exception.getStatus().getCode() == IJavaStatusConstants.EDITOR_POST_SAVE_NOTIFICATION) {
		message= JavaEditorMessages.CompilationUnitEditor_error_saving_participant_message;
		if (hasProjectSettings)
			linkText= JavaEditorMessages.CompilationUnitEditor_error_saving_participant_property_link;
		else
			linkText= JavaEditorMessages.CompilationUnitEditor_error_saving_participant_link;
	} else {
		message= JavaEditorMessages.CompilationUnitEditor_error_saving_editedLines_calculation_message;
		if (hasProjectSettings)
			linkText= JavaEditorMessages.CompilationUnitEditor_error_saving_editedLines_calculation_property_link;
		else
			linkText= JavaEditorMessages.CompilationUnitEditor_error_saving_editedLines_calculation_link;
	}

	IStatus status= exception.getStatus();
	int mask= IStatus.WARNING | IStatus.ERROR;
	ErrorDialog dialog= new ErrorDialog(getSite().getShell(), title, message, status, mask) {
		@Override
		protected Control createMessageArea(Composite parent) {
			Control result= super.createMessageArea(parent);

			// Panic code: use 'parent' instead of 'result' in case super implementation changes in the future
			new Label(parent, SWT.NONE);  // filler as parent has 2 columns (icon and label)
			Link link= new Link(parent, SWT.NONE);
			link.setText(linkText);
			link.setFont(parent.getFont());
			link.addSelectionListener(new SelectionAdapter() {
				@Override
				public void widgetSelected(SelectionEvent e) {
					if (hasProjectSettings)
						PreferencesUtil.createPropertyDialogOn(getShell(), javaProject, SaveParticipantPreferencePage.PROPERTY_PAGE_ID, null, null).open();
					else
						PreferencesUtil.createPreferenceDialogOn(getShell(), SaveParticipantPreferencePage.PREFERENCE_PAGE_ID, null, null).open();
				}
			});
			GridData gridData= new GridData(SWT.FILL, SWT.BEGINNING, true, false);
			link.setLayoutData(gridData);

			return result;
		}
		@Override
		protected Image getImage() {
			return getWarningImage();
		}
	};
	dialog.open();
}
 
Example 19
Source File: SpellingPreferencePage.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected Control createContents(Composite parent)
{
	Composite composite = new Composite(parent, SWT.NONE);
	composite.setLayout(GridLayoutFactory.swtDefaults().create());
	composite.setLayoutData(GridDataFactory.fillDefaults().create());

	globalPreferencesLink = new Link(composite, SWT.NONE);
	globalPreferencesLink.setLayoutData(GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).create());

	Label label = new Label(composite, SWT.NONE);
	label.setText(StringUtil.makeFormLabel(Messages.SpellingPreferencePage_label));
	label.setLayoutData(GridDataFactory.swtDefaults().indent(SWT.DEFAULT, 5).align(SWT.FILL, SWT.CENTER).create());

	tableViewer = CheckboxTableViewer.newCheckList(composite, SWT.BORDER);
	tableViewer.getTable().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
	tableViewer.setContentProvider(ArrayContentProvider.getInstance());
	tableViewer.setLabelProvider(new LabelProvider()
	{
		@Override
		public String getText(Object element)
		{
			return ScopeDefinitions.DEFINITIONS.get(element);
		}
	});
	tableViewer.setInput(ScopeDefinitions.DEFINITIONS.keySet());
	tableViewer.setCheckedElements(SpellingPreferences.getEnabledScopes().toArray());

	globalPreferencesLink.addSelectionListener(new SelectionAdapter()
	{
		@Override
		public void widgetSelected(SelectionEvent e)
		{
			((IWorkbenchPreferenceContainer) getContainer()).openPage(GENERAL_SPELLING_PREF_ID, null);
		}
	});

	applyDialogFont(composite);
	updateStatus();
	return composite;
}
 
Example 20
Source File: CleanUpPostSaveListener.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected Control createMessageArea(Composite parent) {
	initializeDialogUnits(parent);

	Composite messageComposite= new Composite(parent, SWT.NONE);
	messageComposite.setFont(parent.getFont());
	GridLayout layout= new GridLayout();
	layout.numColumns= 1;
	layout.marginHeight= 0;
	layout.marginWidth= 0;
	layout.verticalSpacing= convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
	layout.horizontalSpacing= convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
	messageComposite.setLayout(layout);
	messageComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

	Label explain= new Label(messageComposite, SWT.WRAP);
	explain.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
	explain.setText(FixMessages.CleanUpPostSaveListener_SlowCleanUpWarningDialog_explain);

	final BulletListBlock cleanUpListBlock= new BulletListBlock(messageComposite, SWT.NONE);
	GridData gridData= new GridData(SWT.FILL, SWT.FILL, true, true);
	cleanUpListBlock.setLayoutData(gridData);
	cleanUpListBlock.setText(fCleanUpNames);

	TextLayout textLayout= new TextLayout(messageComposite.getDisplay());
	textLayout.setText(fCleanUpNames);
	int lineCount= textLayout.getLineCount();
	if (lineCount < 5)
		gridData.heightHint= textLayout.getLineBounds(0).height * 6;
	textLayout.dispose();

	Link link= new Link(messageComposite, SWT.NONE);
	link.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
	link.setText(FixMessages.CleanUpPostSaveListener_SlowCleanUpDialog_link);

	link.addSelectionListener(new SelectionAdapter() {
		/*
		 * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
		 */
		@Override
		public void widgetSelected(SelectionEvent e) {
			PreferencesUtil.createPreferenceDialogOn(getShell(), SaveParticipantPreferencePage.PREFERENCE_PAGE_ID, null, null).open();
		}
	});

	return messageComposite;
}