本文整理汇总了Java中org.eclipse.ui.forms.widgets.FormText类的典型用法代码示例。如果您正苦于以下问题:Java FormText类的具体用法?Java FormText怎么用?Java FormText使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FormText类属于org.eclipse.ui.forms.widgets包,在下文中一共展示了FormText类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createToolTipContentArea
import org.eclipse.ui.forms.widgets.FormText; //导入依赖的package包/类
@Override
protected Composite createToolTipContentArea(Event event, Composite parent){
FormToolkit toolkit = new FormToolkit(parent.getDisplay());
FormColors colors = toolkit.getColors();
Form form = toolkit.createForm(parent);
GridLayout layout = new GridLayout();
layout.numColumns = 1;
form.getBody().setLayout(layout);
FormText text = toolkit.createFormText(form.getBody(), true);
GridData td = new GridData();
td.heightHint = 200;
td.widthHint = 300;
text.setLayoutData(td);
try {
text.setText("<form>"+m_htmlString+"</form>", true, true);
} catch (IllegalArgumentException e) {
text.setText("<form><p>Fehlerhafter ToolTip Eingabestring</p><br /></form>", true, true);
}
return parent;
}
示例2: buildConstraintText
import org.eclipse.ui.forms.widgets.FormText; //导入依赖的package包/类
private FormText buildConstraintText(BinaryTemporalConstraint constraint, EPlanElement origin, Composite parent) {
FormText text = constraintPrinter.createConstraintText(toolkit, parent);
// display the english
String string = "<form><p>";
string += constraintPrinter.getText(constraint, origin);
String rationale = constraint.getRationale();
if ((rationale != null) && (rationale.trim().length() != 0)) {
string += "</p><p>" + constraintPrinter.getRationaleText(constraint);
}
string += "</p></form>";
text.setText(string, true, false);
trace.debug(" : " + string);
// activate the links for hover/clicking
text.addHyperlinkListener(new TemporalNodeHyperlinkListener(selectionProvider, model.getEPlan(), identifiableRegistry));
return text;
}
示例3: getFormText
import org.eclipse.ui.forms.widgets.FormText; //导入依赖的package包/类
/**
* Override to return form text for the violation. The form text
* object is available for calling setColor/setFont. Do not call
* setText on this because it will be ignored.
* Example: Activity Requirement: ALL_S_BAND_AVAIL is required during COMMS-ETF HRD-DL involving COMMS-ETF HRD-DL
* @param text
* @param identifiableRegistry
* @return
*/
public String getFormText(FormText text, IdentifiableRegistry<EPlanElement> identifiableRegistry) {
PlanPrinter printer = new PlanPrinter(identifiableRegistry);
StringBuilder builder = new StringBuilder();
builder.append(StringEscapeFormat.escape(getType()));
builder.append(": ");
builder.append(StringEscapeFormat.escape(getName()));
builder.append(" ");
builder.append(StringEscapeFormat.escape(getDescription()));
List<? extends EPlanElement> elements = getElements();
if (!elements.isEmpty()) {
builder.append(" (involves ");
List<String> strings = new ArrayList<String>(elements.size());
for (EPlanElement element : elements) {
strings.add(printer.getText(element));
}
builder.append(PlanPrinter.getListText(strings));
builder.append(")");
}
appendTime(builder);
return builder.toString();
}
示例4: getFormText
import org.eclipse.ui.forms.widgets.FormText; //导入依赖的package包/类
@Override
public String getFormText(FormText text, IdentifiableRegistry<EPlanElement> identifiableRegistry) {
if (constraint != null) {
return getConstraintFormText(text, identifiableRegistry);
}
if (effect != null) {
return getEffectFormText(text, identifiableRegistry);
}
PlanPrinter printer = new PlanPrinter(identifiableRegistry);
StringBuilder builder = new StringBuilder();
if (difference instanceof ChangedByModifyingParameterOrReference) {
buildModificationFormText((ChangedByModifyingParameterOrReference)difference, printer, builder);
} else if (difference instanceof ChangedByRemovingElement) {
buildRemovalFormText((ChangedByRemovingElement)difference, printer, builder);
} else if (difference instanceof ChangedByAddingNewElement) {
buildAdditionFormText((ChangedByAddingNewElement)difference, printer, builder);
}
return builder.toString();
}
示例5: getConstraintFormText
import org.eclipse.ui.forms.widgets.FormText; //导入依赖的package包/类
private String getConstraintFormText(FormText text, IdentifiableRegistry<EPlanElement> identifiableRegistry) {
if (text != null) {
text.setColor("start", ColorConstants.darkGreen);
text.setColor("end", ColorConstants.red);
}
if (constraint instanceof ProfileConstraint) {
return getProfileConstraintFormText((ProfileConstraint)constraint, identifiableRegistry);
}
TemporalConstraintPrinter constraintPrinter = new TemporalConstraintPrinter(identifiableRegistry);
if (constraint instanceof BinaryTemporalConstraint) {
BinaryTemporalConstraint binary = (BinaryTemporalConstraint)constraint;
return constraintPrinter.getText(binary, null);
} else if (constraint instanceof PeriodicTemporalConstraint) {
PeriodicTemporalConstraint periodic = (PeriodicTemporalConstraint)constraint;
return constraintPrinter.getText(periodic, false);
} else if (constraint instanceof TemporalChain) {
TemporalChain chain = (TemporalChain)constraint;
return constraintPrinter.getText(chain, null);
}
return "";
}
示例6: createFormText
import org.eclipse.ui.forms.widgets.FormText; //导入依赖的package包/类
/**
* Creates a form text.
*
* @param parent the parent to put the form text on
* @param text the form text to be displayed
* @return the created form text
*
* @see FormToolkit#createFormText(org.eclipse.swt.widgets.Composite, boolean)
*/
private FormText createFormText(Composite parent, String text) {
FormToolkit toolkit= new FormToolkit(getShell().getDisplay());
try {
FormText formText= toolkit.createFormText(parent, true);
formText.setFont(parent.getFont());
try {
formText.setText(text, true, false);
} catch (IllegalArgumentException e) {
formText.setText(e.getMessage(), false, false);
JavaPlugin.log(e);
}
formText.marginHeight= 2;
formText.marginWidth= 0;
formText.setBackground(null);
formText.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
return formText;
} finally {
toolkit.dispose();
}
}
示例7: createLabel
import org.eclipse.ui.forms.widgets.FormText; //导入依赖的package包/类
/**
* Create a label with a hyperlink and a picture.
*
* @param parent the parent widget of the label
* @param text the text of the label
* @param action the action to be executed if the hyperlink is activated
*/
private void createLabel(Composite parent, String text, final BuildpathModifierAction action) {
FormText formText= createFormText(parent, text);
Image image= fImageMap.get(action.getId());
if (image == null) {
image= action.getImageDescriptor().createImage();
fImageMap.put(action.getId(), image);
}
formText.setImage("defaultImage", image); //$NON-NLS-1$
formText.addHyperlinkListener(new HyperlinkAdapter() {
@Override
public void linkActivated(HyperlinkEvent e) {
action.run();
}
});
}
示例8: AbstractEASyEditorPage
import org.eclipse.ui.forms.widgets.FormText; //导入依赖的package包/类
/**
* Sole constructor for this class.
* @param plp The {@link ProductLineProject} edited in this editor page.
* @param title The title for this editor page.
* @param parent The parent, holding this editor page.
*/
public AbstractEASyEditorPage(ProductLineProject plp, String title, Composite parent) {
super(parent, SWT.BORDER);
this.plp = plp;
setLayout(new FillLayout());
pageListeners = new ArrayList<IEASyPageListener>();
toolkit = new FormToolkit(getDisplay()); // display is assumed to be valid!
contentPane = toolkit.createScrolledForm(this);
GridLayout layout = new GridLayout();
contentPane.getBody().setLayout(layout);
//Set Title contentPane.setText(text) will cause that scrollbars won't work correctly.
FormText titleText = toolkit.createFormText(contentPane.getBody(), false);
String htmlTitle = "<form><p><span color=\"header\" font=\"header\">" + title + ": " + plp.getProjectName()
+ "</span></p></form>";
titleText.setWhitespaceNormalized(true);
titleText.setFont("header", JFaceResources.getHeaderFont());
titleText.setColor("header", toolkit.getColors().getColor(IFormColors.TITLE));
titleText.setText(htmlTitle, true, false);
}
示例9: createPluginsSection
import org.eclipse.ui.forms.widgets.FormText; //导入依赖的package包/类
private void createPluginsSection(Composite parent) {
Section sctnPlugins = createSection(parent, "Plug-ins");
sctnPlugins.setLayout(FormUtils.createClearTableWrapLayout(false, 1));
TableWrapData data = new TableWrapData(TableWrapData.FILL_GRAB);
sctnPlugins.setLayoutData(data);
FormText text = formToolkit.createFormText(sctnPlugins, true);
ImageDescriptor idesc = HybridUI.getImageDescriptor(HybridUI.PLUGIN_ID, "/icons/etool16/cordovaplug_wiz.png");
text.setImage("plugin", idesc.createImage());
text.setText(PLUGINS_SECTION_CONTENT, true, false);
sctnPlugins.setClient(text);
text.addHyperlinkListener(this);
}
示例10: configureFormText
import org.eclipse.ui.forms.widgets.FormText; //导入依赖的package包/类
private void configureFormText(final Form form, FormText text) {
text.addHyperlinkListener(new HyperlinkAdapter() {
@SuppressWarnings("unchecked")
public void linkActivated(HyperlinkEvent e) {
String is = (String) e.getHref();
try {
((FormText) e.widget).getShell().dispose();
int index = Integer.parseInt(is);
IMessage[] messages = form.getChildrenMessages();
IMessage message = messages[index];
Set<IvyNodeElement> conflicts = (Set<IvyNodeElement>) message.getData();
if (conflicts != null) {
viewer.setSelection(new StructuredSelection(new ArrayList<>(conflicts)));
}
} catch (NumberFormatException ex) {
}
}
});
text.setImage("error", getImage(IMessageProvider.ERROR));
text.setImage("warning", getImage(IMessageProvider.WARNING));
text.setImage("info", getImage(IMessageProvider.INFORMATION));
}
示例11: initFormText
import org.eclipse.ui.forms.widgets.FormText; //导入依赖的package包/类
public static void initFormText(FormText formText) {
formText.setWhitespaceNormalized(false);
Font formTextFont = formText.getFont();
FontData formTextFontData = formTextFont.getFontData()[0];
FontData h1FontData = new FontData(formTextFontData.getName(), formTextFontData.getHeight() + 5, SWT.BOLD);
final Font h1Font = new Font(formTextFont.getDevice(), h1FontData);
formText.setFont(FONT_H1_KEY, h1Font);
FontData h3FontData = new FontData(formTextFontData.getName(), formTextFontData.getHeight() + 3, SWT.BOLD);
final Font h3Font = new Font(formTextFont.getDevice(), h3FontData);
formText.setFont(FONT_H3_KEY, h3Font);
Font codeFont = JFaceResources.getTextFont();
formText.setFont(FONT_CODE_KEY, codeFont);
formText.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
h1Font.dispose();
h3Font.dispose();
}
});
// Set fontKeySet = JFaceResources.getFontRegistry().getKeySet();
// if (fontKeySet != null) {
// for (Object fontKey : fontKeySet) {
// System.out.println(fontKey);
// }
// }
}
示例12: bindToExternalLink
import org.eclipse.ui.forms.widgets.FormText; //导入依赖的package包/类
public static void bindToExternalLink(final FormText formText, final String key, final String webSiteTaggerDocUrl) {
formText.addHyperlinkListener(new HyperlinkAdapter(){
@Override
public void linkActivated(HyperlinkEvent e) {
if(e.getHref().equals(key)) {
try {
java.awt.Desktop.getDesktop().browse(java.net.URI.create(webSiteTaggerDocUrl));
} catch (IOException e1) {
MessageDialog.openInformation(formText.getShell(), "No browser found", "Could not open the url in your Web browser.");
}
}
}
});
}
示例13: getFormText
import org.eclipse.ui.forms.widgets.FormText; //导入依赖的package包/类
@Override
public String getFormText(FormText text, IdentifiableRegistry<EPlanElement> identifiableRegistry) {
setupFormText(text);
String printed = new ConstraintViolationPrinter(identifiableRegistry).getBoundText(temporalBound);
StringBuilder builder = new StringBuilder(printed);
appendWaiverRationale(builder, temporalBound.getWaiverRationale());
return builder.toString();
}
示例14: getFormText
import org.eclipse.ui.forms.widgets.FormText; //导入依赖的package包/类
@Override
public String getFormText(FormText text, IdentifiableRegistry<EPlanElement> identifiableRegistry) {
setupFormText(text);
String printed = super.getFormText(text, identifiableRegistry);
StringBuilder builder = new StringBuilder(printed);
TemporalChain chain = getChain();
if (chain != null) {
appendWaiverRationale(builder, chain.getWaiverRationale());
}
return builder.toString();
}
示例15: getFormText
import org.eclipse.ui.forms.widgets.FormText; //导入依赖的package包/类
@Override
public String getFormText(FormText text, IdentifiableRegistry<EPlanElement> identifiableRegistry) {
setupFormText(text);
String printed = new ConstraintViolationPrinter(identifiableRegistry).getDistanceText(temporalRelation);
StringBuilder builder = new StringBuilder(printed);
appendWaiverRationale(builder, temporalRelation.getWaiverRationale());
return builder.toString();
}