本文整理匯總了Java中org.eclipse.swt.widgets.Link類的典型用法代碼示例。如果您正苦於以下問題:Java Link類的具體用法?Java Link怎麽用?Java Link使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Link類屬於org.eclipse.swt.widgets包,在下文中一共展示了Link類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: LinkComposite
import org.eclipse.swt.widgets.Link; //導入依賴的package包/類
public LinkComposite ( final Composite parent, final int style, final String format )
{
super ( parent, style );
final RowLayout layout = new RowLayout ();
layout.wrap = false;
layout.center = true;
layout.spacing = 7;
layout.pack = true;
setLayout ( layout );
this.textLabel = new Link ( this, SWT.NONE );
this.textLabel.setText ( format );
this.textLabel.addSelectionListener ( new SelectionAdapter () {
@Override
public void widgetSelected ( final SelectionEvent event )
{
logger.info ( "LinkComponent selected: {}", event.text ); //$NON-NLS-1$
Program.launch ( event.text );
}
} );
}
示例2: createDialogArea
import org.eclipse.swt.widgets.Link; //導入依賴的package包/類
/**
* Create contents of the dialog.
* @param parent
*/
@Override
protected Control createDialogArea(Composite parent) {
Composite container = (Composite) super.createDialogArea(parent);
Link link = new Link(container, SWT.NONE);
link.setText("Your project has been successfully deployed.\n\nYou can try it with this URL:\n<a href=\""+ projectURL + "\">" + projectURL + "</a>");
link.addListener (SWT.Selection, new Listener () {
public void handleEvent(Event event) {
org.eclipse.swt.program.Program.launch(event.text);
}
});
link.setSize(330, 150);
return container;
}
示例3: createContents
import org.eclipse.swt.widgets.Link; //導入依賴的package包/類
private void createContents(String str) {
aboutToolsShell = new Shell(getParent(), getStyle());
aboutToolsShell.setImage(SWTResourceManager.getImage(ShortcutKeyExplain.class, Resource.IMAGE_ICON));
aboutToolsShell.setSize(400, 391);
aboutToolsShell.setText(getText());
PubUtils.setCenterinParent(getParent(), aboutToolsShell);
Link link = new Link(aboutToolsShell, SWT.NONE);
link.setBounds(143, 336, 108, 17);
link.setText("<a>www.itlaborer.com</a>");
link.addSelectionListener(new LinkSelection());
StyledText readMeTextLabel = new StyledText(aboutToolsShell,
SWT.BORDER | SWT.READ_ONLY | SWT.WRAP | SWT.V_SCROLL);
readMeTextLabel.setBounds(3, 33, 389, 297);
readMeTextLabel.setText(str);
Label label_2 = new Label(aboutToolsShell, SWT.NONE);
label_2.setFont(org.eclipse.wb.swt.SWTResourceManager.getFont("微軟雅黑", 9, SWT.BOLD));
label_2.setText("快捷鍵說明:");
label_2.setBounds(3, 12, 136, 17);
}
示例4: addSelectionListenerToLink
import org.eclipse.swt.widgets.Link; //導入依賴的package包/類
private void addSelectionListenerToLink(final PropertyToolTipInformation propertyInfo, final Link link) {
link.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if(OPERATION.equalsIgnoreCase(propertyInfo.getPropertyName()))
transformMapping.setAddPassThroughFields(true);
else if(JOIN_MAPPING.equalsIgnoreCase(propertyInfo.getPropertyName()))
{
joinMappingGrid.setAddPassThroughFields(true);
}
else if(LOOKUP_MAPPING.equalsIgnoreCase(propertyInfo.getPropertyName()))
{
lookupMappingGrid.setAddPassThroughFields(true);
}
link.setLinkForeground(CustomColorRegistry.INSTANCE.getColorFromRegistry( 0,0,255));
}
});
}
示例5: addListenerToOpenOpeartionClassFile
import org.eclipse.swt.widgets.Link; //導入依賴的package包/類
/**
* Add listener to open operation class file
*
* @param filePath
* @param link
*/
private void addListenerToOpenOpeartionClassFile(final String filePath,
Link link) {
link.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
logger.debug("ComponentTooltip.widgetSelected(): Link clicked");
super.widgetSelected(e);
boolean flag = FilterOperationClassUtility.INSTANCE.openFileEditor(null,filePath);
if (!flag) {
logger.debug("ComponentTooltip.widgetSelected(): Link clicked - error - File " + filePath + " Not Found");
WidgetUtility.errorMessage("File Not Found");
} else {
logger.debug("ComponentTooltip.widgetSelected(): Link clicked - hiding tooltip");
setVisible(false);
}
}
});
logger.debug("ComponentTooltip.addListenerToOpenOpeartionClassFile(): added opeartion class link listener");
}
示例6: createFieldEditors
import org.eclipse.swt.widgets.Link; //導入依賴的package包/類
/**
* Creates the field editors. Field editors are abstractions of the common
* GUI blocks needed to manipulate various types of preferences. Each field
* editor knows how to save and restore itself.
*/
public void createFieldEditors() {
Composite composite = getFieldEditorParent();
String message = "You can visit the project site at <a href=\"https://github.com/de-jcup/egradle/wiki\">GitHub</a>.";
Link link = new Link(composite, SWT.NONE);
link.setText(message);
link.setSize(400, 100);
link.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
try {
// Open default external browser
PlatformUI.getWorkbench().getBrowserSupport().getExternalBrowser().openURL(new URL(e.text));
} catch (Exception ex) {
MainActivator.getDefault().getLog().log(new Status(IStatus.ERROR, MainActivator.PLUGIN_ID, "Was not able to open url in external browser", ex));
}
}
});
}
示例7: createDialogArea
import org.eclipse.swt.widgets.Link; //導入依賴的package包/類
@Override
protected Control createDialogArea(final Composite parent) {
Composite dialogArea = (Composite) super.createDialogArea(parent);
Composite container = new Composite(dialogArea, SWT.NONE);
Link flexPricing = new Link(container, SWT.WRAP);
flexPricing.setText(Messages.getString("deploy.preferences.dialog.flex.pricing")); //$NON-NLS-1$
flexPricing.addSelectionListener(
new OpenUriSelectionListener(new ErrorDialogErrorHandler(getShell())));
FontUtil.convertFontToItalic(flexPricing);
GridDataFactory.fillDefaults().grab(true, true).applyTo(container);
Point margins = LayoutConstants.getMargins();
GridLayoutFactory.fillDefaults()
.extendedMargins(margins.x, margins.x, 0 /* no upper margin */, margins.y)
.generateLayout(container);
return dialogArea;
}
示例8: ProjectSelector
import org.eclipse.swt.widgets.Link; //導入依賴的package包/類
public ProjectSelector(Composite parent) {
super(parent, SWT.NONE);
GridLayoutFactory.fillDefaults().numColumns(2).spacing(0, 0).applyTo(this);
Composite tableComposite = new Composite(this, SWT.NONE);
TableColumnLayout tableColumnLayout = new TableColumnLayout();
tableComposite.setLayout(tableColumnLayout);
GridDataFactory.fillDefaults().grab(true, true).applyTo(tableComposite);
viewer = new TableViewer(tableComposite, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION);
createColumns(tableColumnLayout);
viewer.getTable().setHeaderVisible(true);
viewer.getTable().setLinesVisible(false);
input = WritableList.withElementType(GcpProject.class);
projectProperties = PojoProperties.values(new String[] {"name", "id"}); //$NON-NLS-1$ //$NON-NLS-2$
ViewerSupport.bind(viewer, input, projectProperties);
viewer.setComparator(new ViewerComparator());
Composite linkComposite = new Composite(this, SWT.NONE);
statusLink = new Link(linkComposite, SWT.WRAP);
statusLink.addSelectionListener(
new OpenUriSelectionListener(new ErrorDialogErrorHandler(getShell())));
statusLink.setText("");
GridDataFactory.fillDefaults().span(2, 1).applyTo(linkComposite);
GridLayoutFactory.fillDefaults().generateLayout(linkComposite);
}
示例9: addComment
import org.eclipse.swt.widgets.Link; //導入依賴的package包/類
private void addComment( Composite parent , String text ){
final Link link = new Link( parent , SWT.LEFT );
link.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true));
link.setText(text);
link.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
final String href = event.text;
if( href != null ){
new Thread( new Runnable() {
public void run() throws TGException {
TGCommunityWeb.open(getContext(), href);
}
} ).start();
}
}
});
}
示例10: doLinkActivated
import org.eclipse.swt.widgets.Link; //導入依賴的package包/類
final void doLinkActivated(Link link) {
Map data = new HashMap();
data.put(DATA_NO_LINK, Boolean.TRUE);
if (isProjectPreferencePage()) {
openWorkspacePreferences(data);
} else {
/*
* HashSet projectsWithSpecifics= new HashSet(); try {
* IJavaScriptProject[] projects=
* JavaScriptCore.create(ResourcesPlugin.getWorkspace().getRoot()).
* getJavaScriptProjects(); for (int i= 0; i < projects.length; i++)
* { IJavaScriptProject curr= projects[i]; if
* (hasProjectSpecificOptions(curr.getProject())) {
* projectsWithSpecifics.add(curr); } } } catch
* (JavaScriptModelException e) { // ignore } ProjectSelectionDialog
* dialog= new ProjectSelectionDialog(getShell(),
* projectsWithSpecifics); if (dialog.open() == Window.OK) {
* IJavaScriptProject res= (IJavaScriptProject)
* dialog.getFirstResult(); openProjectProperties(res.getProject(),
* data); }
*/
}
}
示例11: createControls
import org.eclipse.swt.widgets.Link; //導入依賴的package包/類
protected void createControls() {
group = new Group(this, SWT.NONE);
group.setLayout(new GridLayout(3, false));
imageLabel = new Label(group, SWT.NONE);
GridDataFactory.fillDefaults().grab(false, false).align(SWT.BEGINNING, SWT.CENTER).applyTo(imageLabel);
textLabel = new Link(group, SWT.WRAP);
textLabel.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (DOWNLOAD_LINK.equals(e.text)) {
Program.launch(DOWNLOAD_LINK);
} else {
PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(getShell(), PREF_PAGE_ID,
new String[] { DISPLAY_ID }, null);
dialog.setSelectedNode("DISPLAY_ID");
dialog.open();
}
}
});
GridDataFactory.fillDefaults().grab(true, false).align(SWT.CENTER, SWT.CENTER).applyTo(textLabel);
button = new Button(group, SWT.FLAT);
button.setText("Download");
GridDataFactory.fillDefaults().grab(false, false).align(SWT.END, SWT.CENTER).applyTo(button);
}
示例12: createControl
import org.eclipse.swt.widgets.Link; //導入依賴的package包/類
@Override
public void createControl(final Composite parent, FormToolkit toolkit) {
link = new Link(parent, SWT.BORDER);
link.setText("<a>" + getValue() + "</a>");
link.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event event) {
try {
RepositoryCommit commit = getCommit();
if (commit != null) {
CommitEditor.openQuiet(commit);
} else {
MessageDialog alert = new MessageDialog(parent.getShell(), "Oops", null,
"Commit " + getValue() + " not found", MessageDialog.ERROR, new String[] {"OK"}, 0);
alert.open();
}
} catch (IOException e) {
AppraiseUiPlugin.logError("Error reading commit " + getValue(), e);
}
}
});
setControl(link);
}
示例13: createMessageArea
import org.eclipse.swt.widgets.Link; //導入依賴的package包/類
@Override
protected Control createMessageArea(Composite composite)
{
String message = this.message;
this.message = null;
Composite messageArea = (Composite) super.createMessageArea(composite);
messageLink = new Link(messageArea, getMessageLabelStyle() | SWT.NO_FOCUS);
messageLink.setText("<a></a>" + message); //$NON-NLS-1$
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.BEGINNING).grab(true, false)
.hint(convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH), SWT.DEFAULT)
.applyTo(messageLink);
messageLink.addSelectionListener(new SelectionAdapter()
{
public void widgetSelected(SelectionEvent e)
{
openLink(e);
}
});
return messageArea;
}
示例14: createUI_Field_Text
import org.eclipse.swt.widgets.Link; //導入依賴的package包/類
private int createUI_Field_Text(final Composite parent) {
{
/*
* Link: Fulltext search hint
*/
final Link link = new Link(parent, SWT.NONE);
link.setText(Messages.Slideout_TourFilter_Link_TextSearchHint);
link.setToolTipText(Messages.Slideout_TourFilter_Link_TextSearchHint_Tooltip);
link.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent e) {
Util.showView(SearchView.ID, true);
}
});
}
return 1;
}
示例15: createUI_270_IC_3_99_Actions
import org.eclipse.swt.widgets.Link; //導入依賴的package包/類
private void createUI_270_IC_3_99_Actions(final Composite parent) {
// V-spacer
new Label(parent, SWT.NONE);
{
_linkIC_ILActions = new Link(parent, SWT.NONE);
_linkIC_ILActions.setText(Messages.Dialog_ImportConfig_Link_OtherActions);
_linkIC_ILActions.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent e) {
onSelect_IC_LauncherActions();
}
});
GridDataFactory
.fillDefaults()//
.grab(true, false)
.span(2, 1)
.align(SWT.FILL, SWT.CENTER)
.applyTo(_linkIC_ILActions);
}
// V-spacer
new Label(parent, SWT.NONE);
}