本文整理匯總了Java中org.eclipse.swt.widgets.Link.addListener方法的典型用法代碼示例。如果您正苦於以下問題:Java Link.addListener方法的具體用法?Java Link.addListener怎麽用?Java Link.addListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.swt.widgets.Link
的用法示例。
在下文中一共展示了Link.addListener方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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;
}
示例2: 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();
}
}
});
}
示例3: 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);
}
示例4: setBackupWorkspace
import org.eclipse.swt.widgets.Link; //導入方法依賴的package包/類
private void setBackupWorkspace() {
if (warning == null) {
warning = new Label(this, SWT.WRAP);
warning.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true, false, 2, 1));
warning.setText(ResourceManager.instance().getLabel("targettree.isbackup.warning"));
warning.setForeground(Colors.C_RED);
more = new Link(this, SWT.NONE);
more.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false, 2, 1));
more.setText("<A HREF=\"" + ArecaURLs.BACKUP_COPY_URL + "\">" + ResourceManager.instance().getLabel("targettree.isbackup.more") + "</A>");
more.addListener (SWT.Selection, new Listener () {
public void handleEvent(Event event) {
try {
ViewerHandlerHelper.getViewerHandler().browse(new URL(event.text));
} catch (Exception e) {
Logger.defaultLogger().error(e);
}
}
});
this.layout(true);
}
}
示例5: initAdditionalParametersUi
import org.eclipse.swt.widgets.Link; //導入方法依賴的package包/類
private void initAdditionalParametersUi() {
Composite container = new Composite(this, 0);
container.setLayout(new GridLayout(1, false));
container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
Link help = new Link(container, 0);
String t2iParsLink="https://transkribus.eu/wiki/index.php/Text2ImageParameters";
help.setText("Advanced Parameters, see <a href=\""+t2iParsLink+"\">"+t2iParsLink+"</a>");
help.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event e) {
try {
org.eclipse.swt.program.Program.launch(e.text);
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
}
}
});
advancedParameters = new Text(container, SWT.MULTI | SWT.BORDER | SWT.WRAP | SWT.V_SCROLL);
advancedParameters.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
advancedParameters.setToolTipText("Advanced parameters for Text2Image - use key=value format in each line!");
advancedParameters.setText( "thresh=0.01\n"+
"hyphen=null\n"+
"hyphen_lang=null\n"+
"skip_word=null\n"+
"skip_bl=null\n"+
"jump_bl=null\n"+
"best_pathes=Infinity\n"
);
}
示例6: createContents
import org.eclipse.swt.widgets.Link; //導入方法依賴的package包/類
protected Control createContents(Composite parent) {
Label label = new Label(parent, SWT.NONE);
label.setText("YAKINDU Statechart Tools general settings.");
Link link = new Link(parent, SWT.NONE);
link.setText("For more information visit <a>www.statecharts.org</a>");
link.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
org.eclipse.swt.program.Program.launch(YAKINDU_ORG);
}
});
return parent;
}
示例7: createControl
import org.eclipse.swt.widgets.Link; //導入方法依賴的package包/類
@Override
public void createControl(final Composite parent, FormToolkit toolkit) {
Composite composite = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout(1, false);
composite.setLayout(layout);
final String filePath =
getTaskAttribute().getAttribute(AppraiseReviewTaskSchema.DIFF_NEWPATH).getValue();
Link fileLink = new Link(composite, SWT.BORDER);
fileLink.setText("<a>View in Workspace</a>");
fileLink.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event event) {
AppraiseUiPlugin.openFileInEditor(filePath, getModel().getTaskRepository());
}
});
final String diffText =
getTaskAttribute().getAttribute(AppraiseReviewTaskSchema.DIFF_TEXT).getValue();
final StyledText text = new StyledText(composite, SWT.MULTI | SWT.LEFT | SWT.BORDER | SWT.READ_ONLY);
text.setText(diffText);
text.setStyleRanges(getStyleRangesForDiffText(diffText));
GridData diffTextGridData = new GridData();
diffTextGridData.grabExcessHorizontalSpace = true;
diffTextGridData.horizontalAlignment = SWT.FILL;
text.setLayoutData(diffTextGridData);
composite.pack();
setControl(composite);
}
示例8: createControl
import org.eclipse.swt.widgets.Link; //導入方法依賴的package包/類
@Override
public void createControl(final Composite parent, FormToolkit toolkit) {
Composite composite = new Composite(parent, SWT.NONE);
RowLayout layout = new RowLayout(SWT.VERTICAL);
layout.wrap = true;
layout.fill = true;
layout.justify = false;
composite.setLayout(layout);
label = new Label(composite, SWT.NONE);
label.setText(getValue());
final String commit = getCommit();
final String filePath = getFilePath();
final int lineNo = getLineNumber();
if (filePath != null && !filePath.isEmpty()) {
fileLink = new Link(composite, SWT.BORDER);
fileLink.setText("<a>" + filePath + '(' + lineNo + ")</a>");
fileLink.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event event) {
AppraiseUiPlugin.openFileInEditor(filePath, getModel().getTaskRepository());
}
});
}
if (commit != null) {
commitLabel = new Label(composite, SWT.BORDER);
commitLabel.setText(commit);
}
composite.pack();
setControl(composite);
}
示例9: build
import org.eclipse.swt.widgets.Link; //導入方法依賴的package包/類
public static Link build(Composite composite) {
Link lnk = new Link(composite, SWT.NONE);
lnk.addListener (SWT.Selection, new Listener() {
public void handleEvent(Event event) {
try {
ViewerHandlerHelper.getViewerHandler().browse(new URL(event.text));
} catch (Exception e) {
Logger.defaultLogger().error(e);
}
}
});
lnk.setText("<A HREF=\"" + DONATION_URL + "\">" + ResourceManager.instance().getLabel("about.support") + "</A>");
return lnk;
}
示例10: createDialogArea
import org.eclipse.swt.widgets.Link; //導入方法依賴的package包/類
@Override
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
Link messageLnk = new Link(composite,SWT.NONE);
messageLnk.setText(this.message);
messageLnk.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event event) {
OpenCheatSheetAction ch = new OpenCheatSheetAction("org.eclipse.thym.ui.requirements.cordova");
ch.run();
}
});
return composite;
}
示例11: createDialogArea
import org.eclipse.swt.widgets.Link; //導入方法依賴的package包/類
protected Control createDialogArea( Composite parent )
{
Composite container = (Composite) super.createDialogArea( parent );
setTitle( Messages.getString( "ReportExamples.ContributeSamples.title" ) ); //$NON-NLS-1$
setMessage( Messages.getString( "ReportExamples.ContributeSamples.messages" ) ); //$NON-NLS-1$
super.getShell( ).setText( Messages.getString( "ReportExamples.ContributeSamples.title" ) ); //$NON-NLS-1$
Composite composite = new Composite( container, SWT.NONE );
GridData gd = new GridData( GridData.FILL_BOTH
| GridData.VERTICAL_ALIGN_BEGINNING );
gd.widthHint = 380;
gd.heightHint = 200;
gd.horizontalIndent = 10;
composite.setLayoutData( gd );
composite.setLayout( new GridLayout( ) );
new Label( composite, SWT.NONE );
Link link = new Link( composite, SWT.WRAP );
link.setLayoutData( new GridData( GridData.FILL_HORIZONTAL
| GridData.VERTICAL_ALIGN_BEGINNING ) );
String[] arguments = new String[2];
arguments[0] = "<a>"; //$NON-NLS-1$
arguments[1] = "</a>"; //$NON-NLS-1$
String linkText = Messages.getFormattedString( "ReportExamples.ContributeSamples.description", arguments ); //$NON-NLS-1$
link.setText( linkText );
link.addListener( SWT.Selection, new Listener( ) {
public void handleEvent( Event event )
{
openLink( "https://bugs.eclipse.org/bugs/enter_bug.cgi?product=BIRT&bug_severity=enhancement" ); //$NON-NLS-1$
}
} );
link.setSize( 300, 50 );
return container;
}
示例12: createAnswerArea
import org.eclipse.swt.widgets.Link; //導入方法依賴的package包/類
private void createAnswerArea(Composite container) {
linkToAnswer = new Link(container, SWT.NONE);
GridData gridDataUser = new GridData();
gridDataUser.horizontalAlignment = SWT.FILL;
linkToAnswer.setLayoutData(gridDataUser);
// launches the operating system executable associated with the file or URL
linkToAnswer.addListener(SWT.Selection, event -> Program.launch(event.text));
// add empty label to the grid
new Label(container, SWT.NONE);
browser = new Browser(container, SWT.BORDER);
GridData gridDataBrowser = new GridData();
gridDataBrowser.grabExcessVerticalSpace = true;
gridDataBrowser.grabExcessHorizontalSpace = true;
gridDataBrowser.horizontalAlignment = SWT.FILL;
gridDataBrowser.verticalAlignment = SWT.FILL;
browser.setLayoutData(gridDataBrowser);
// add empty label to the grid
new Label(container, SWT.NONE);
Composite btns = new Composite(container, SWT.NONE);
RowLayout rowLayout = new RowLayout();
btns.setLayout(rowLayout);
final Button previousBtn = new Button(btns, SWT.PUSH);
final Button nextBtn = new Button(btns, SWT.PUSH);
previousBtn.setText("Previous answer");
nextBtn.setText("Next answer");
Listener listener = (event) ->
{
if (event.widget == nextBtn) {
if (answerCount == answers.size() - 1) {
answerCount = 0;
} else {
answerCount += 1;
}
setAnswerContent();
} else if (answerCount == 0) {
answerCount = answers.size() - 1;
} else {
answerCount -= 1;
}
setAnswerContent();
};
nextBtn.addListener(SWT.Selection, listener);
previousBtn.addListener(SWT.Selection, listener);
setAnswerContent();
}
示例13: createUI_80_Link
import org.eclipse.swt.widgets.Link; //導入方法依賴的package包/類
/**
* Url
*/
private void createUI_80_Link() {
final String urlText = _hoveredTourMarker.getUrlText();
final String urlAddress = _hoveredTourMarker.getUrlAddress();
final boolean isText = urlText.length() > 0;
final boolean isAddress = urlAddress.length() > 0;
if (isText || isAddress) {
final Link linkUrl = new Link(_ttContainer, SWT.NONE);
GridDataFactory.fillDefaults()//
.indent(3, 0)
.applyTo(linkUrl);
linkUrl.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(final Event event) {
onSelectUrl(event.text);
}
});
String linkText;
if (isAddress == false) {
// only text is in the link -> this is not a internet address but create a link of it
linkText = "<a href=\"" + urlText + "\">" + urlText + "</a>"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
} else if (isText == false) {
linkText = "<a href=\"" + urlAddress + "\">" + urlAddress + "</a>"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
} else {
linkText = "<a href=\"" + urlAddress + "\">" + urlText + "</a>"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
linkUrl.setText(linkText);
setUrlWidth(linkUrl, linkText);
}
}
示例14: createContents
import org.eclipse.swt.widgets.Link; //導入方法依賴的package包/類
@Override
protected Control createContents(final Composite parent) {
PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IProvSDKHelpContextIds.PROVISIONING_PREFERENCE_PAGE);
GridData gd;
final Composite container = new Composite(parent, SWT.NULL);
GridLayout layout = new GridLayout();
layout.marginWidth = layout.marginHeight = 0;
container.setLayout(layout);
{
// Group for show all versions vs. show latest
browsingGroup = new Group(container, SWT.NONE);
browsingGroup.setText(ProvSDKMessages.ProvisioningPreferencePage_BrowsingPrefsGroup);
layout = new GridLayout();
layout.numColumns = 3;
browsingGroup.setLayout(layout);
gd = new GridData(GridData.FILL_HORIZONTAL);
browsingGroup.setLayoutData(gd);
{
showLatestRadio = new Button(browsingGroup, SWT.RADIO);
showLatestRadio.setText(ProvSDKMessages.ProvisioningPreferencePage_ShowLatestVersions);
gd = new GridData();
gd.horizontalSpan = 3;
showLatestRadio.setLayoutData(gd);
showAllRadio = new Button(browsingGroup, SWT.RADIO);
showAllRadio.setText(ProvSDKMessages.ProvisioningPreferencePage_ShowAllVersions);
gd = new GridData();
gd.horizontalSpan = 3;
showAllRadio.setLayoutData(gd);
}
//Group for validating a failed plan
validateGroup = new Group(container, SWT.NONE);
validateGroup.setText(ProvSDKMessages.ProvisioningPreferencePage_OpenWizardIfInvalid);
layout = new GridLayout();
layout.numColumns = 3;
validateGroup.setLayout(layout);
gd = new GridData(GridData.FILL_HORIZONTAL);
validateGroup.setLayoutData(gd);
{
alwaysShowFailedPlan = new Button(validateGroup, SWT.RADIO);
alwaysShowFailedPlan.setText(ProvSDKMessages.ProvisioningPreferencePage_AlwaysOpenWizard);
gd = new GridData();
gd.horizontalSpan = 3;
alwaysShowFailedPlan.setLayoutData(gd);
neverShowFailedPlan = new Button(validateGroup, SWT.RADIO);
neverShowFailedPlan.setText(ProvSDKMessages.ProvisioningPreferencePage_NeverOpenWizard);
gd = new GridData();
gd.horizontalSpan = 3;
neverShowFailedPlan.setLayoutData(gd);
promptOnFailedPlan = new Button(validateGroup, SWT.RADIO);
promptOnFailedPlan.setText(ProvSDKMessages.ProvisioningPreferencePage_PromptToOpenWizard);
gd = new GridData();
gd.horizontalSpan = 3;
promptOnFailedPlan.setLayoutData(gd);
}
//Link to installed software page
//See https://bugs.eclipse.org/bugs/show_bug.cgi?id=313242
final Link link = new Link(container, SWT.PUSH);
link.setText(ProvSDKMessages.ProvisioningPreferencePage_UninstallUpdateLink);
link.addListener(SWT.Selection, new Listener() {
public void handleEvent(final Event event) {
ProvUI.openInstallationDialog(event);
}
});
}
initialize();
Dialog.applyDialogFont(container);
return container;
}
示例15: createContents
import org.eclipse.swt.widgets.Link; //導入方法依賴的package包/類
protected Control createContents(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
composite.setLayout(new GridLayout(1, false));
ListPane pane = new ListPane(composite, SWT.BORDER, true);
GridData dt = new GridData(SWT.FILL, SWT.FILL, true, true);
dt.heightHint = computeHeight(230);
dt.widthHint = computeWidth(700);
pane.setLayoutData(dt);
Composite grpDisp = pane.addElement("appearence", RM.getLabel("preferences.appearence.title"));
Composite grpStart = pane.addElement("startup", RM.getLabel("preferences.startup.title"));
Composite grpArchives = pane.addElement("workspace", RM.getLabel("preferences.workspace.title"));
grpDisp.setLayout(new GridLayout(2, false));
buildAppearenceComposite(grpDisp);
grpStart.setLayout(new GridLayout(3, false));
buildStartupComposite(grpStart);
grpArchives.setLayout(new GridLayout(3, false));
buildArchivesComposite(grpArchives);
lblPrfPath = new Link(composite, SWT.NONE);
lblPrfPath.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true, false));
lblPrfPath.setText("<A HREF=\"\">" + ArecaUserPreferences.getPath() + "</A>");
lblPrfPath.addListener (SWT.Selection, new Listener() {
public void handleEvent(Event event) {
try {
ViewerHandlerHelper.getViewerHandler().open(new File(ArecaUserPreferences.getPath()));
} catch (Exception e) {
Logger.defaultLogger().error(e);
}
}
});
SavePanel pnlSave = new SavePanel(this);
pnlSave.buildComposite(composite).setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
btnSave = pnlSave.getBtnSave();
pane.setSelection(0);
composite.pack();
return composite;
}