我正在为eclipse构建一个插件,并使用以下代码在我的视图中添加一个tabfolder:
private void constructViewWindow(Composite parent){
final TabFolder tabFolder = new TabFolder(parent, SWT.NONE);
terminologyTab = new TabItem(tabFolder, SWT.NONE);
grammarTab = new TabItem(tabFolder, SWT.NONE);
styleTab = new TabItem(tabFolder, SWT.NONE);
xmlTab = new TabItem(tabFolder, SWT.NONE);
terminologyTable = new Table(tabFolder, SWT.BORDER);
grammarTable = new Table(tabFolder, SWT.BORDER);
styleTable = new Table(tabFolder, SWT.BORDER);
xmlTable = new Table(tabFolder, SWT.BORDER);
addTableColumns(terminologyTable);
addTableColumns(grammarTable);
addTableColumns(styleTable);
addTableColumns(xmlTable);
terminologyTab.setControl(terminologyTable);
grammarTab.setControl(grammarTable);
styleTab.setControl(styleTable);
xmlTab.setControl(xmlTable);
}
导致以下窗口:
非常好。但是我现在想要为此添加一个描述/一些附加信息,这些信息最终与“&0; 0”项目相同。任务视图中的文本:
由于我不确定这会被称为什么,谷歌搜索有点困难(例如我已经尝试了#34;将标题添加到表格#34;,但标题显然是别的。 "描述"并没有真正做到这一点)。我想有人可以在eclipse源代码中找到这个,但是因为我是Java新手,潜入日食源并找到我需要的东西需要相当长的时间(至少对我而言),任何人都有任何想法关于如何在我的TabFolder上添加这一额外的文本行?
答案 0 :(得分:0)
只需在标签文件夹之前向复合材料添加private void constructViewWindow(Composite parent){
label = new Label(parent, SWT.LEFT);
// TODO set layout on the layout
label.setText("0 items");
final TabFolder tabFolder = new TabFolder(parent, SWT.NONE);
。
ViewForm
您可能需要在标签上设置布局数据,以确保其宽度足以容纳文本。
另一种方法是使用/* Scheduler */
private long triggerDetection(String startDate, String endDate) {
for (UrlRequest request : urlRequests) {
if (!validateRequests.isWhitelisted(request)) {
ContentDetectionClient.detectContent(request);
}
}
}
/* Client */
public void detectContent(UrlRequest urlRequest){
Client client = new Client();
URI uri = buildUrl(); /* It returns the URL of this dropwizard application's resource method provided below */
ClientResponse response = client.resource(uri)
.type(MediaType.APPLICATION_JSON_TYPE)
.post(ClientResponse.class, urlRequest);
Integer status = response.getStatus();
if (status >= 200 && status < 300) {
log.info("Completed request for url: {}", urlRequest.getUrl());
}else{
log.error("request failed for url: {}", urlRequest.getUrl());
}
}
private URI buildUrl() {
return UriBuilder
.fromPath(uriConfiguration.getUrl())
.build();
}
/* Resource Method */
@POST
@Path("/pageDetection")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
/**
* Receives the url of the publisher, crawls the content of that url, applies a detector to check if the content is malicious.
* @returns returns the probability of the page being malicious
* @throws throws exception if the crawl call failed
**/
public DetectionScore detectContent(UrlRequest urlRequest) throws Exception {
return contentAnalysisOrchestrator.detectContentPage(urlRequest);
}
/* Orchestrator */
public DetectionScore detectContentPage(UrlRequest urlRequest) {
try {
Pair<Integer, HtmlPage> response = crawler.rawLoad(urlRequest.getUrl());
String content = response.getValue().text();
DetectionScore detectionScore = detector.getProbability(urlRequest.getUrl(), content);
contentDetectionResultDao.insert(urlRequest.getAffiliateId(), urlRequest.getUrl(),detectionScore.getProbability()*1000,
detectionScore.getRecommendation(), urlRequest.getRequestsPerUrl(), -1, urlRequest.getCreatedAt() );
return detectionScore;
} catch (IOException e) {
log.info("Error while analyzing the url : {}", e);
throw new WebApplicationException(e, Response.Status.INTERNAL_SERVER_ERROR);
}
}
类,它允许您将控件放在页面的角落。