Author: snjeza
Date: 2011-09-27 17:37:55 -0400 (Tue, 27 Sep 2011)
New Revision: 35087
Added:
workspace/snjeza/org.jboss.tools.central.update/features/org.jboss.tools.central.feature_1.0.0.201109272333.jar
workspace/snjeza/org.jboss.tools.central.update/plugins/org.jboss.tools.central_1.0.0.201109272333.jar
Removed:
workspace/snjeza/org.jboss.tools.central.update/features/org.jboss.tools.central.feature_1.0.0.201109261851.jar
workspace/snjeza/org.jboss.tools.central.update/plugins/org.jboss.tools.central_1.0.0.201109261851.jar
Modified:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/GettingStartedPage.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/model/NewsEntry.java
workspace/snjeza/org.jboss.tools.central.update/artifacts.jar
workspace/snjeza/org.jboss.tools.central.update/content.jar
workspace/snjeza/org.jboss.tools.central.update/site.xml
Log:
JBIDE-9368 Dashboard(s) for easy news aggregation, twitter and easy additional/3rd party
plugin installation and project template/creation
Modified:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/GettingStartedPage.java
===================================================================
---
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/GettingStartedPage.java 2011-09-27
21:34:27 UTC (rev 35086)
+++
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/GettingStartedPage.java 2011-09-27
21:37:55 UTC (rev 35087)
@@ -36,6 +36,7 @@
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.preference.PreferenceDialog;
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.JFaceColors;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -48,9 +49,6 @@
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.events.PaintListener;
-import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
@@ -80,8 +78,9 @@
import org.eclipse.ui.forms.widgets.ImageHyperlink;
import org.eclipse.ui.forms.widgets.ScrolledForm;
import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.ui.forms.widgets.TableWrapData;
+import org.eclipse.ui.forms.widgets.TableWrapLayout;
import org.eclipse.ui.ide.IDEActionFactory;
-import org.eclipse.ui.internal.forms.widgets.FormFonts;
import org.eclipse.ui.menus.CommandContributionItem;
import org.eclipse.ui.part.PageBook;
import org.eclipse.ui.plugin.AbstractUIPlugin;
@@ -110,8 +109,6 @@
private ScrolledForm form;
private PageBook newsPageBook;
private ScrolledComposite scrollComposite;
- private static Font authorFont;
- private Font linkFont;
private RefreshNewsJobChangeListener refreshNewsJobChangeListener;
private FormText newsNoteText;
private FormText tutorialsNoteText;
@@ -169,20 +166,11 @@
};
form.addControlListener(controlAdapter);
- final PaintListener paintListener = new PaintListener() {
-
- @Override
- public void paintControl(PaintEvent e) {
- resize();
- }
- };
- //form.addPaintListener(paintListener);
form.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
form.removeControlListener(controlAdapter);
- //form.removePaintListener(paintListener);
form.removeDisposeListener(this);
}
});
@@ -197,7 +185,6 @@
//gd.widthHint = 350;
//gd.heightHint = 100;
newsSection.setLayoutData(gd);
- linkFont = newsSection.getFont();
createNewsToolbar(toolkit, newsSection);
scrollComposite = new ScrolledComposite(newsSection, SWT.V_SCROLL);
@@ -224,9 +211,9 @@
newsExceptionText = createExceptionText(toolkit, newsPageBook);
newsComposite = toolkit.createComposite(newsPageBook, SWT.NONE);
- newsComposite.setLayout(new GridLayout());
- gd =new GridData(SWT.FILL, SWT.FILL, false, false);
- newsComposite.setLayoutData(gd);
+ newsComposite.setLayout(new TableWrapLayout());
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(newsComposite);
+ //newsComposite.setLayoutData(gd);
newsSection.setClient(scrollComposite);
showLoading(newsPageBook, newsLoadingComposite, scrollComposite);
@@ -631,23 +618,7 @@
}
});
}
-
- private Font getAuthorFont(Display display) {
- if (authorFont == null) {
- Font font = JFaceResources.getDefaultFont();
- authorFont = FormFonts.getInstance().getBoldFont(display, font);
- }
- return authorFont;
- }
- private Font getLinkFont(Display display) {
- if (linkFont == null) {
- linkFont = JFaceResources.getDefaultFont();
- }
- return linkFont;
- }
-
-
private void showException(PageBook pageBook, FormText exceptionText, Exception e) {
JBossCentralActivator.log(e);
String message = StringEscapeUtils.escapeXml(e.getMessage());
@@ -808,12 +779,19 @@
}
String text = entry.getFormString();
final FormText formText = toolkit.createFormText(newsComposite, true);
+ TableWrapData td = new TableWrapData();
+ td.indent = 2;
+ Point size = newsComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ td.maxWidth = size.x - 2;
formText.setText(text, true, true);
- Display display = Display.getCurrent();
- formText.setFont(getLinkFont(display));
+ //Display display = Display.getCurrent();
+ //formText.setFont(getLinkFont(display));
formText.setFont("default", JFaceResources.getDefaultFont());
- Font boldFont = getAuthorFont(display);
- formText.setFont("author", boldFont);
+ //formText.setForeground(JFaceColors.getHyperlinkText(getDisplay()));
+ formText.setFont("description", JFaceResources.getDefaultFont());
+ //Font boldFont = getAuthorFont(display);
+ //formText.setFont("author", boldFont);
+ formText.setColor("author", JFaceColors.getHyperlinkText(getDisplay()));
formText.setImage("image", getNewsImage());
if (entry.getDescription() != null && !entry.getDescription().isEmpty()) {
ToolTip toolTip = new NewsToolTip(formText, entry.getDescription());
Modified:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/model/NewsEntry.java
===================================================================
---
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/model/NewsEntry.java 2011-09-27
21:34:27 UTC (rev 35086)
+++
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/model/NewsEntry.java 2011-09-27
21:37:55 UTC (rev 35087)
@@ -2,6 +2,7 @@
import java.util.Date;
+import org.apache.commons.lang.StringEscapeUtils;
import org.jboss.tools.central.JBossCentralActivator;
public class NewsEntry {
@@ -10,10 +11,8 @@
private String description;
private String author;
private Date date;
-
-
+
public NewsEntry() {
-
}
public NewsEntry(String title, String link, String description,
@@ -24,34 +23,43 @@
this.author = author;
this.date = date;
}
-
+
public String getTitle() {
return title;
}
+
public void setTitle(String title) {
this.title = title;
}
+
public String getLink() {
return link;
}
+
public void setLink(String link) {
this.link = link;
}
+
public String getDescription() {
return description;
}
+
public void setDescription(String description) {
this.description = description;
}
+
public String getAuthor() {
return author;
}
+
public void setAuthor(String author) {
this.author = author;
}
+
public Date getDate() {
return date;
}
+
public void setDate(Date date) {
this.date = date;
}
@@ -71,32 +79,83 @@
}
buffer.append("<br/>");
boolean cr = false;
- buffer.append("<span font=\"default\">");
if (date != null) {
+ buffer.append("<span font=\"default\">");
buffer.append("posted on ");
buffer.append(date);
+ buffer.append("</span>");
cr = true;
}
- buffer.append("</span>");
if (author != null && !author.isEmpty()) {
buffer.append(" ");
buffer.append("<span font=\"default\">");
buffer.append(" by");
buffer.append("</span>");
buffer.append(" ");
- buffer.append("<span font=\"author\">");
+ buffer.append("<span color=\"author\"
font=\"author\">");
buffer.append(author);
buffer.append("</span>");
cr = true;
}
if (cr) {
- buffer.append("<br />");
+ buffer.append("<br/>");
}
- //buffer.append("<br />");
+ String shortDescription = getShortDescription();
+ cr = false;
+ if (shortDescription != null && !shortDescription.isEmpty()) {
+ buffer.append("<span font=\"description\">");
+ buffer.append(shortDescription);
+ buffer.append("</span>");
+ cr = true;
+ }
+ if (cr) {
+ buffer.append("<br/><br/>");
+ }
buffer.append(JBossCentralActivator.FORM_END_TAG);
return buffer.toString();
}
+
+ public String getShortDescription() {
+ if (description == null) {
+ return null;
+ }
+ boolean tagStarted = false;
+ StringBuffer buffer = new StringBuffer();
+ for (char c:description.toCharArray()) {
+ if (c == '<') {
+ tagStarted = true;
+ }
+ if (c == '>') {
+ tagStarted = false;
+ } else {
+ if (!tagStarted) {
+ buffer.append(c);
+ }
+ }
+ }
+ char[] chars = StringEscapeUtils.unescapeHtml(buffer.toString().trim()).toCharArray();
+ buffer = new StringBuffer();
+ int i = 0;
+ for (char c:chars) {
+ if (i++ < 140) {
+ buffer.append(c);
+ } else {
+ if ( (c == '_') ||
+ (c >= 'a' && c <= 'z') ||
+ (c >= 'a' && c <= 'Z') ||
+ (c >= '0' && c <= '9') ) {
+ buffer.append(c);
+ } else {
+ break;
+ }
+ }
+ }
+ if (buffer.length() > 0) {
+ buffer.append("...");
+ }
+ return buffer.toString();
+ }
@Override
public String toString() {
Modified: workspace/snjeza/org.jboss.tools.central.update/artifacts.jar
===================================================================
(Binary files differ)
Modified: workspace/snjeza/org.jboss.tools.central.update/content.jar
===================================================================
(Binary files differ)
Deleted:
workspace/snjeza/org.jboss.tools.central.update/features/org.jboss.tools.central.feature_1.0.0.201109261851.jar
===================================================================
(Binary files differ)
Added:
workspace/snjeza/org.jboss.tools.central.update/features/org.jboss.tools.central.feature_1.0.0.201109272333.jar
===================================================================
(Binary files differ)
Property changes on:
workspace/snjeza/org.jboss.tools.central.update/features/org.jboss.tools.central.feature_1.0.0.201109272333.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Deleted:
workspace/snjeza/org.jboss.tools.central.update/plugins/org.jboss.tools.central_1.0.0.201109261851.jar
===================================================================
(Binary files differ)
Added:
workspace/snjeza/org.jboss.tools.central.update/plugins/org.jboss.tools.central_1.0.0.201109272333.jar
===================================================================
(Binary files differ)
Property changes on:
workspace/snjeza/org.jboss.tools.central.update/plugins/org.jboss.tools.central_1.0.0.201109272333.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: workspace/snjeza/org.jboss.tools.central.update/site.xml
===================================================================
--- workspace/snjeza/org.jboss.tools.central.update/site.xml 2011-09-27 21:34:27 UTC (rev
35086)
+++ workspace/snjeza/org.jboss.tools.central.update/site.xml 2011-09-27 21:37:55 UTC (rev
35087)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<site>
- <feature
url="features/org.jboss.tools.central.feature_1.0.0.201109261851.jar"
id="org.jboss.tools.central.feature" version="1.0.0.201109261851">
+ <feature
url="features/org.jboss.tools.central.feature_1.0.0.201109272333.jar"
id="org.jboss.tools.central.feature" version="1.0.0.201109272333">
<category name="org.jboss.tools.central"/>
</feature>
<category-def name="org.jboss.tools.central" label="JBoss
Central"/>