JBoss Tools SVN: r35692 - in trunk/central/plugins/org.jboss.tools.central: src/org/jboss/tools/central/actions and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2011-10-16 17:10:06 -0400 (Sun, 16 Oct 2011)
New Revision: 35692
Added:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/OpenJBossNewsHandler.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/RefreshJBossNewsHandler.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/jobs/RefreshNewsJob.java
Modified:
trunk/central/plugins/org.jboss.tools.central/plugin.xml
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/jobs/RefreshBlogsJob.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/jobs/RefreshDiscoveryJob.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/jobs/RefreshTutorialsJob.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/model/FeedsEntry.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/model/Tutorial.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/model/TutorialCategory.java
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/plugin.xml
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/plugin.xml 2011-10-16 21:09:55 UTC (rev 35691)
+++ trunk/central/plugins/org.jboss.tools.central/plugin.xml 2011-10-16 21:10:06 UTC (rev 35692)
@@ -63,6 +63,12 @@
</command>
<command
+ defaultHandler="org.jboss.tools.central.actions.OpenJBossNewsHandler"
+ name="News"
+ id="org.jboss.tools.central.openJBossNews">
+ </command>
+
+ <command
defaultHandler="org.jboss.tools.central.actions.RefreshJBossTutorialsHandler"
name="Refresh"
id="org.jboss.tools.central.refreshJBossTutorials">
@@ -73,6 +79,11 @@
id="org.jboss.tools.central.refreshJBossBlogs">
</command>
<command
+ defaultHandler="org.jboss.tools.central.actions.RefreshJBossNewsHandler"
+ name="Refresh"
+ id="org.jboss.tools.central.refreshJBossNews">
+ </command>
+ <command
defaultHandler="org.jboss.tools.central.actions.RefreshDiscoveryHandler"
name="Refresh"
id="org.jboss.tools.central.refreshDiscovery">
@@ -135,10 +146,18 @@
icon="icons/blogs.gif">
</image>
<image
+ commandId="org.jboss.tools.central.openJBossNews"
+ icon="icons/news.png">
+ </image>
+ <image
commandId="org.jboss.tools.central.refreshJBossBlogs"
icon="icons/refresh.gif">
</image>
<image
+ commandId="org.jboss.tools.central.refreshJBossNews"
+ icon="icons/refresh.gif">
+ </image>
+ <image
commandId="org.jboss.tools.central.refreshJBossTutorials"
icon="icons/refresh.gif">
</image>
Added: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/OpenJBossNewsHandler.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/OpenJBossNewsHandler.java (rev 0)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/OpenJBossNewsHandler.java 2011-10-16 21:10:06 UTC (rev 35692)
@@ -0,0 +1,28 @@
+/*************************************************************************************
+ * Copyright (c) 2008-2011 Red Hat, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+
+package org.jboss.tools.central.actions;
+
+import org.jboss.tools.central.JBossCentralActivator;
+
+/**
+ *
+ * @author snjeza
+ *
+ */
+public class OpenJBossNewsHandler extends OpenWithBrowserHandler {
+
+ @Override
+ public String getLocation() {
+ return JBossCentralActivator.NEWS_URL;
+ }
+
+}
Added: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/RefreshJBossNewsHandler.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/RefreshJBossNewsHandler.java (rev 0)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/RefreshJBossNewsHandler.java 2011-10-16 21:10:06 UTC (rev 35692)
@@ -0,0 +1,35 @@
+/*************************************************************************************
+ * Copyright (c) 2008-2011 Red Hat, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+
+package org.jboss.tools.central.actions;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.jobs.Job;
+import org.jboss.tools.central.jobs.RefreshBlogsJob;
+
+/**
+ *
+ * @author snjeza
+ *
+ */
+public class RefreshJBossNewsHandler extends AbstractHandler {
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ if (RefreshBlogsJob.INSTANCE.getState() == Job.NONE) {
+ RefreshBlogsJob.INSTANCE.schedule();
+ }
+ return null;
+ }
+
+}
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-10-16 21:09:55 UTC (rev 35691)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/GettingStartedPage.java 2011-10-16 21:10:06 UTC (rev 35692)
@@ -89,6 +89,7 @@
import org.jboss.tools.central.JBossCentralActivator;
import org.jboss.tools.central.dialogs.ProjectExamplesDialog;
import org.jboss.tools.central.jobs.RefreshBlogsJob;
+import org.jboss.tools.central.jobs.RefreshNewsJob;
import org.jboss.tools.central.jobs.RefreshTutorialsJob;
import org.jboss.tools.central.model.FeedsEntry;
import org.jboss.tools.central.model.Tutorial;
@@ -112,7 +113,7 @@
private IWorkbenchAction newWizardDropDownAction;
private ScrolledForm form;
private PageBook blogsPageBook;
- private ScrolledComposite scrollComposite;
+ private ScrolledComposite blogsScrollComposite;
private RefreshBlogsJobChangeListener refreshBlogsJobChangeListener;
private FormText blogsNoteText;
private FormText tutorialsNoteText;
@@ -134,6 +135,14 @@
private Composite documentationComposite;
private Set<TutorialCategory> expandedCategories = new HashSet<TutorialCategory>();
+ private Section newsSection;
+ private ScrolledComposite newsScrollComposite;
+ private PageBook newsPageBook;
+ private FormText newsNoteText;
+ private Composite newsLoadingComposite;
+ private FormText newsExceptionText;
+ private Composite newsComposite;
+ private RefreshNewsJobChangeListener refreshNewsJobChangeListener;
public GettingStartedPage(FormEditor editor) {
super(editor, ID, "Getting Started");
@@ -160,7 +169,8 @@
toolkit.paintBordersFor(left);
Composite right = createComposite(toolkit, body);
- createBlogsSection(toolkit, right);
+ createNewsSection(toolkit, right);
+ createBlogsSection(toolkit, right);
toolkit.paintBordersFor(right);
final ControlAdapter controlAdapter = new ControlAdapter() {
@@ -186,26 +196,26 @@
}
private void createBlogsSection(FormToolkit toolkit, Composite parent) {
- blogsSection = createSection(toolkit, parent, "Blogs", ExpandableComposite.TITLE_BAR|ExpandableComposite.EXPANDED);
- GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ blogsSection = createSection(toolkit, parent, "Blogs", ExpandableComposite.TITLE_BAR|ExpandableComposite.EXPANDED|ExpandableComposite.TWISTIE);
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, true, false);
//gd.widthHint = 350;
//gd.heightHint = 100;
blogsSection.setLayoutData(gd);
createBlogsToolbar(toolkit, blogsSection);
- scrollComposite = new ScrolledComposite(blogsSection, SWT.V_SCROLL);
+ blogsScrollComposite = new ScrolledComposite(blogsSection, SWT.V_SCROLL);
gd =new GridData(SWT.FILL, SWT.FILL, true, false);
- scrollComposite.setLayoutData(gd);
- scrollComposite.setLayout(new GridLayout());
+ blogsScrollComposite.setLayoutData(gd);
+ blogsScrollComposite.setLayout(new GridLayout());
- blogsPageBook = new PageBook(scrollComposite, SWT.WRAP);
+ blogsPageBook = new PageBook(blogsScrollComposite, SWT.WRAP);
gd =new GridData(SWT.FILL, SWT.FILL, true, false);
blogsPageBook.setLayoutData(gd);
- scrollComposite.setContent(blogsPageBook);
- scrollComposite.setExpandVertical(true);
- scrollComposite.setExpandHorizontal(true);
- scrollComposite.setAlwaysShowScrollBars(false);
+ blogsScrollComposite.setContent(blogsPageBook);
+ blogsScrollComposite.setExpandVertical(true);
+ blogsScrollComposite.setExpandHorizontal(true);
+ blogsScrollComposite.setAlwaysShowScrollBars(false);
blogsNoteText = createNoteText(toolkit, blogsPageBook);
blogsLoadingComposite = createLoadingComposite(toolkit, blogsPageBook);
@@ -215,15 +225,71 @@
blogsComposite.setLayout(new TableWrapLayout());
GridDataFactory.fillDefaults().grab(true, false).applyTo(blogsComposite);
- blogsSection.setClient(scrollComposite);
- showLoading(blogsPageBook, blogsLoadingComposite, scrollComposite);
+ blogsSection.setClient(blogsScrollComposite);
+ blogsSection.addExpansionListener(new ExpansionAdapter() {
+
+ @Override
+ public void expansionStateChanged(ExpansionEvent e) {
+ resize();
+ }
+
+ });
+ showLoading(blogsPageBook, blogsLoadingComposite, blogsScrollComposite);
blogsPageBook.pack(true);
RefreshBlogsJob refreshBlogsJob = RefreshBlogsJob.INSTANCE;
refreshBlogsJobChangeListener = new RefreshBlogsJobChangeListener();
refreshBlogsJob.addJobChangeListener(refreshBlogsJobChangeListener);
refreshBlogsJob.schedule();
}
+
+ private void createNewsSection(FormToolkit toolkit, Composite parent) {
+ newsSection = createSection(toolkit, parent, "News", ExpandableComposite.TITLE_BAR|ExpandableComposite.EXPANDED|ExpandableComposite.TWISTIE);
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, true, false);
+ //gd.widthHint = 350;
+ //gd.heightHint = 100;
+ newsSection.setLayoutData(gd);
+ createNewsToolbar(toolkit, newsSection);
+
+ newsScrollComposite = new ScrolledComposite(newsSection, SWT.V_SCROLL);
+ gd =new GridData(SWT.FILL, SWT.FILL, true, false);
+ newsScrollComposite.setLayoutData(gd);
+ newsScrollComposite.setLayout(new GridLayout());
+
+ newsPageBook = new PageBook(newsScrollComposite, SWT.WRAP);
+ gd =new GridData(SWT.FILL, SWT.FILL, true, false);
+ newsPageBook.setLayoutData(gd);
+
+ newsScrollComposite.setContent(newsPageBook);
+ newsScrollComposite.setExpandVertical(true);
+ newsScrollComposite.setExpandHorizontal(true);
+ newsScrollComposite.setAlwaysShowScrollBars(false);
+ newsNoteText = createNoteText(toolkit, newsPageBook);
+ newsLoadingComposite = createLoadingComposite(toolkit, newsPageBook);
+ newsExceptionText = createExceptionText(toolkit, newsPageBook);
+
+ newsComposite = toolkit.createComposite(newsPageBook, SWT.NONE);
+ newsComposite.setLayout(new TableWrapLayout());
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(newsComposite);
+
+ newsSection.setClient(newsScrollComposite);
+ newsSection.addExpansionListener(new ExpansionAdapter() {
+
+ @Override
+ public void expansionStateChanged(ExpansionEvent e) {
+ resize();
+ }
+
+ });
+ showLoading(newsPageBook, newsLoadingComposite, newsScrollComposite);
+ newsPageBook.pack(true);
+ RefreshNewsJob refreshNewsJob = RefreshNewsJob.INSTANCE;
+ refreshNewsJobChangeListener = new RefreshNewsJobChangeListener();
+ refreshNewsJob.addJobChangeListener(refreshNewsJobChangeListener);
+ refreshNewsJob.schedule();
+ }
+
+
private FormText createExceptionText(FormToolkit toolkit, Composite parent) {
FormText formText = toolkit.createFormText(parent, true);
GridData gd = new GridData(GridData.FILL, GridData.FILL, false, false);
@@ -283,6 +349,29 @@
section.setTextClient(headerComposite);
}
+ private void createNewsToolbar(FormToolkit toolkit, Section section) {
+ Composite headerComposite = toolkit.createComposite(section, SWT.NONE);
+ RowLayout rowLayout = new RowLayout();
+ rowLayout.marginTop = 0;
+ rowLayout.marginBottom = 0;
+ headerComposite.setLayout(rowLayout);
+ headerComposite.setBackground(null);
+
+ ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT | SWT.HORIZONTAL);
+ toolBarManager.createControl(headerComposite);
+
+ CommandContributionItem item = JBossCentralActivator.createContributionItem(getSite(), "org.jboss.tools.central.openJBossNews");
+ toolBarManager.add(item);
+
+ item = JBossCentralActivator.createContributionItem(getSite(), "org.jboss.tools.central.refreshJBossNews");
+ toolBarManager.add(item);
+
+ toolBarManager.update(true);
+
+ section.setTextClient(headerComposite);
+ }
+
+
private void createTutorialsSection(FormToolkit toolkit, Composite parent) {
tutorialsSection = createSection(toolkit, parent, "Project Examples", ExpandableComposite.TITLE_BAR|ExpandableComposite.TWISTIE);
GridData gd = new GridData(SWT.FILL, SWT.FILL, false, false);
@@ -568,6 +657,10 @@
RefreshBlogsJob.INSTANCE.removeJobChangeListener(refreshBlogsJobChangeListener);
refreshBlogsJobChangeListener = null;
}
+ if (refreshNewsJobChangeListener != null) {
+ RefreshNewsJob.INSTANCE.removeJobChangeListener(refreshNewsJobChangeListener);
+ refreshNewsJobChangeListener = null;
+ }
if (refreshTutorialsJobChangeListener != null) {
RefreshTutorialsJob.INSTANCE.removeJobChangeListener(refreshTutorialsJobChangeListener);
refreshTutorialsJobChangeListener = null;
@@ -643,13 +736,30 @@
}
List<FeedsEntry> entries = job.getEntries();
if (entries == null || entries.size() == 0) {
- showNote(blogsPageBook, blogsNoteText, scrollComposite);
+ showNote(blogsPageBook, blogsNoteText, blogsScrollComposite);
return;
}
- showBlogs(entries);
+ showEntries(entries, blogsComposite, blogsPageBook, blogsScrollComposite);
}
}
+ public void refreshNews() {
+ RefreshNewsJob job = RefreshNewsJob.INSTANCE;
+ if (job.getState() == Job.NONE) {
+ if (job.getException() != null) {
+ showException(newsPageBook, newsExceptionText,
+ job.getException());
+ return;
+ }
+ List<FeedsEntry> entries = job.getEntries();
+ if (entries == null || entries.size() == 0) {
+ showNote(newsPageBook, newsNoteText, newsScrollComposite);
+ return;
+ }
+ showEntries(entries, newsComposite, newsPageBook, newsScrollComposite);
+ }
+ }
+
public void refreshTutorials() {
RefreshTutorialsJob job = RefreshTutorialsJob.INSTANCE;
if (job.getException() != null) {
@@ -786,19 +896,19 @@
}
}
- private void showBlogs(List<FeedsEntry> entries) {
+ private void showEntries(List<FeedsEntry> entries, Composite composite, PageBook pageBook, ScrolledComposite scrollable) {
int i = 0;
- disposeChildren(blogsComposite);
+ disposeChildren(composite);
for (final FeedsEntry entry:entries) {
if (i++ > JBossCentralActivator.MAX_FEEDS) {
return;
}
String text = entry.getFormString();
- final FormText formText = toolkit.createFormText(blogsComposite, true);
+ final FormText formText = toolkit.createFormText(composite, true);
TableWrapData td = new TableWrapData();
td.indent = 2;
- Point size = blogsComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ Point size = composite.computeSize(SWT.DEFAULT, SWT.DEFAULT);
td.maxWidth = size.x - 2;
try {
// to avoid illegal argumentexception on formtext fields.
@@ -838,22 +948,49 @@
});
}
- blogsPageBook.showPage(blogsComposite);
+ pageBook.showPage(composite);
form.reflow(true);
form.redraw();
- recomputeScrollComposite(scrollComposite, blogsPageBook);
+ recomputeScrollComposite(scrollable, pageBook);
}
protected void resize() {
- Point size = form.getSize();
+ Point size = form.getBody().getSize();
GridData gd;
+ Point computedSize;
int widthHint = size.x/2 - 40;
+ gd = (GridData) newsSection.getLayoutData();
+ if (newsSection.isExpanded()) {
+ if (blogsSection.isExpanded()) {
+ gd.heightHint = size.y/2 - 20;
+ } else {
+ gd.heightHint = size.y - 40;
+ }
+ } else {
+ computedSize = newsSection.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ gd.heightHint = computedSize.y;
+ }
+ gd.widthHint = widthHint;
+ gd.grabExcessVerticalSpace = false;
+ computedSize = newsSection.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ newsSection.setSize(widthHint, computedSize.y);
+
gd = (GridData) blogsSection.getLayoutData();
- gd.heightHint = size.y - 40;
+ if (blogsSection.isExpanded()) {
+ if (newsSection.isExpanded()) {
+ gd.heightHint = size.y/2 - 20;
+ } else {
+ gd.heightHint = size.y - 40;
+ }
+ } else {
+ computedSize = blogsSection.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ gd.heightHint = computedSize.y;
+ }
+
gd.widthHint = widthHint;
gd.grabExcessVerticalSpace = false;
- Point computedSize = blogsSection.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ computedSize = blogsSection.computeSize(SWT.DEFAULT, SWT.DEFAULT);
blogsSection.setSize(widthHint, computedSize.y);
gd = (GridData) tutorialsSection.getLayoutData();
@@ -880,7 +1017,8 @@
form.reflow(true);
form.redraw();
- scrollComposite.setMinSize(widthHint, size.y - 55);
+ blogsScrollComposite.setMinSize(widthHint, size.y - 55);
+ newsScrollComposite.setMinSize(widthHint, size.y - 55);
computedSize = tutorialPageBook.computeSize(SWT.DEFAULT, SWT.DEFAULT);
int y = computedSize.y;
@@ -888,7 +1026,9 @@
y = 200;
}
tutorialScrollComposite.setMinSize(widthHint, y);
+ refreshNews();
refreshBlogs();
+
form.layout(true, true);
}
@@ -924,7 +1064,7 @@
@Override
public void scheduled(IJobChangeEvent event) {
RefreshBlogsJob.INSTANCE.setException(null);
- showLoading(blogsPageBook, blogsLoadingComposite, scrollComposite);
+ showLoading(blogsPageBook, blogsLoadingComposite, blogsScrollComposite);
}
@Override
@@ -976,4 +1116,46 @@
}
+ private class RefreshNewsJobChangeListener implements IJobChangeListener {
+
+ @Override
+ public void aboutToRun(IJobChangeEvent event) {
+
+ }
+
+ @Override
+ public void awake(IJobChangeEvent event) {
+
+ }
+
+ @Override
+ public void done(IJobChangeEvent event) {
+ Display.getDefault().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ refreshNews();
+ }
+ });
+
+ }
+
+ @Override
+ public void running(IJobChangeEvent event) {
+
+ }
+
+ @Override
+ public void scheduled(IJobChangeEvent event) {
+ RefreshNewsJob.INSTANCE.setException(null);
+ showLoading(newsPageBook, newsLoadingComposite, newsScrollComposite);
+ }
+
+ @Override
+ public void sleeping(IJobChangeEvent event) {
+
+ }
+
+ }
+
}
Modified: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/jobs/RefreshBlogsJob.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/jobs/RefreshBlogsJob.java 2011-10-16 21:09:55 UTC (rev 35691)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/jobs/RefreshBlogsJob.java 2011-10-16 21:10:06 UTC (rev 35692)
@@ -1,3 +1,13 @@
+/*************************************************************************************
+ * Copyright (c) 2008-2011 Red Hat, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
package org.jboss.tools.central.jobs;
import java.net.MalformedURLException;
@@ -20,6 +30,11 @@
import com.sun.syndication.io.SyndFeedInput;
import com.sun.syndication.io.XmlReader;
+/**
+ *
+ * @author snjeza
+ *
+ */
public class RefreshBlogsJob extends Job {
private List<FeedsEntry> entries = new ArrayList<FeedsEntry>();
Modified: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/jobs/RefreshDiscoveryJob.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/jobs/RefreshDiscoveryJob.java 2011-10-16 21:09:55 UTC (rev 35691)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/jobs/RefreshDiscoveryJob.java 2011-10-16 21:10:06 UTC (rev 35692)
@@ -1,3 +1,13 @@
+/*************************************************************************************
+ * Copyright (c) 2008-2011 Red Hat, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
package org.jboss.tools.central.jobs;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -8,6 +18,11 @@
import org.jboss.tools.central.JBossCentralActivator;
import org.jboss.tools.central.editors.JBossCentralEditor;
+/**
+ *
+ * @author snjeza
+ *
+ */
public class RefreshDiscoveryJob extends Job {
public static RefreshDiscoveryJob INSTANCE = new RefreshDiscoveryJob();
Added: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/jobs/RefreshNewsJob.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/jobs/RefreshNewsJob.java (rev 0)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/jobs/RefreshNewsJob.java 2011-10-16 21:10:06 UTC (rev 35692)
@@ -0,0 +1,159 @@
+/*************************************************************************************
+ * Copyright (c) 2008-2011 Red Hat, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.central.jobs;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import org.apache.commons.lang.StringEscapeUtils;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.jboss.tools.central.JBossCentralActivator;
+import org.jboss.tools.central.model.FeedsEntry;
+
+import com.sun.syndication.feed.synd.SyndContent;
+import com.sun.syndication.feed.synd.SyndEntry;
+import com.sun.syndication.feed.synd.SyndFeed;
+import com.sun.syndication.io.SyndFeedInput;
+import com.sun.syndication.io.XmlReader;
+
+/**
+ *
+ * @author snjeza
+ *
+ */
+public class RefreshNewsJob extends Job {
+
+ private List<FeedsEntry> entries = new ArrayList<FeedsEntry>();
+ private Exception exception;
+ public static RefreshNewsJob INSTANCE = new RefreshNewsJob(JBossCentralActivator.NEWS_ATOM_URL);
+
+ private String newsurl;
+
+ private RefreshNewsJob(String newsurl) {
+ super("Refreshing JBoss Blogs...");
+ setPriority(LONG);
+ this.newsurl=newsurl;
+ }
+
+ @Override
+ public IStatus run(IProgressMonitor monitor) {
+ if (monitor.isCanceled()) {
+ return Status.CANCEL_STATUS;
+ }
+ entries.clear();
+ SyndFeedInput input = new SyndFeedInput();
+ URL url;
+ try {
+ url = new URL(newsurl);
+ } catch (MalformedURLException e) {
+ exception = e;
+ return Status.CANCEL_STATUS;
+ }
+ try {
+ SyndFeed syndFeed = input.build(new XmlReader(url));
+ List<SyndEntry> feeds = syndFeed.getEntries();
+ if (feeds == null || feeds.size() == 0) {
+ return Status.OK_STATUS;
+ }
+ int i = 0;
+
+ for (SyndEntry feed:feeds) {
+ FeedsEntry entry = adaptEntry(feed);
+ if (entry == null) {
+ continue;
+ }
+ if (i++ > JBossCentralActivator.MAX_FEEDS) {
+ break;
+ }
+ entries.add(entry);
+ }
+ } catch (Exception e) {
+ exception = e;
+ return Status.CANCEL_STATUS;
+ }
+ return Status.OK_STATUS;
+ }
+
+
+ private FeedsEntry adaptEntry(SyndEntry entry) {
+ if (entry == null) {
+ return null;
+ }
+ String title = null;
+ if (entry.getTitle() != null) {
+ title = entry.getTitle();
+ } else {
+ SyndContent titleEx = entry.getTitleEx();
+ if (titleEx != null && !titleEx.getValue().isEmpty()) {
+ title = titleEx.getValue();
+ }
+ }
+ if (title == null) {
+ return null;
+ }
+ title = StringEscapeUtils.escapeHtml(title);
+ String link;
+ if (entry.getLink() != null) {
+ link = entry.getLink();
+ } else {
+ link = entry.getUri();
+ }
+ String description = null;
+ if (entry.getDescription() != null) {
+ SyndContent desc = entry.getDescription();
+ if (desc != null && !desc.getValue().isEmpty()) {
+ description = desc.getValue();
+ }
+ }
+ if (description == null) {
+ List<SyndContent> contents = entry.getContents();
+ if (contents != null && contents.size() > 0) {
+ SyndContent desc = contents.get(0);
+ if (desc != null && !desc.getValue().isEmpty()) {
+ description = desc.getValue();
+ }
+ }
+ }
+
+
+ Date date;
+ if (entry.getUpdatedDate() != null) {
+ date = entry.getUpdatedDate();
+ } else {
+ date = entry.getPublishedDate();
+ }
+ String author = entry.getAuthor();
+ if (author != null) {
+ author = StringEscapeUtils.escapeHtml(author);
+ }
+
+ //description = " " + description;
+ return new FeedsEntry(title, link, description, entry.getAuthor(), date);
+ }
+
+ public Exception getException() {
+ return exception;
+ }
+
+ public void setException(Exception exception) {
+ this.exception = exception;
+ }
+
+ public List<FeedsEntry> getEntries() {
+ return entries;
+ }
+}
Modified: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/jobs/RefreshTutorialsJob.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/jobs/RefreshTutorialsJob.java 2011-10-16 21:09:55 UTC (rev 35691)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/jobs/RefreshTutorialsJob.java 2011-10-16 21:10:06 UTC (rev 35692)
@@ -1,3 +1,13 @@
+/*************************************************************************************
+ * Copyright (c) 2008-2011 Red Hat, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
package org.jboss.tools.central.jobs;
import java.util.ArrayList;
@@ -19,6 +29,11 @@
import org.jboss.tools.project.examples.model.ProjectFix;
import org.jboss.tools.project.examples.model.ProjectUtil;
+/**
+ *
+ * @author snjeza
+ *
+ */
public class RefreshTutorialsJob extends Job {
private Exception exception;
Modified: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/model/FeedsEntry.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/model/FeedsEntry.java 2011-10-16 21:09:55 UTC (rev 35691)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/model/FeedsEntry.java 2011-10-16 21:10:06 UTC (rev 35692)
@@ -1,3 +1,13 @@
+/*************************************************************************************
+ * Copyright (c) 2008-2011 Red Hat, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
package org.jboss.tools.central.model;
import java.util.Date;
@@ -3,9 +13,13 @@
import org.apache.commons.lang.StringEscapeUtils;
-import org.apache.commons.lang.StringUtils;
import org.jboss.tools.central.JBossCentralActivator;
import com.ocpsoft.pretty.time.PrettyTime;
+/**
+ *
+ * @author snjeza
+ *
+ */
public class FeedsEntry {
private String title;
Modified: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/model/Tutorial.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/model/Tutorial.java 2011-10-16 21:09:55 UTC (rev 35691)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/model/Tutorial.java 2011-10-16 21:10:06 UTC (rev 35692)
@@ -1,3 +1,13 @@
+/*************************************************************************************
+ * Copyright (c) 2008-2011 Red Hat, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
package org.jboss.tools.central.model;
import org.jboss.tools.project.examples.model.Project;
@@ -2,2 +12,7 @@
+/**
+ *
+ * @author snjeza
+ *
+ */
public class Tutorial implements Comparable<Tutorial> {
Modified: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/model/TutorialCategory.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/model/TutorialCategory.java 2011-10-16 21:09:55 UTC (rev 35691)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/model/TutorialCategory.java 2011-10-16 21:10:06 UTC (rev 35692)
@@ -1,3 +1,13 @@
+/*************************************************************************************
+ * Copyright (c) 2008-2011 Red Hat, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
package org.jboss.tools.central.model;
import java.util.Set;
@@ -3,4 +13,9 @@
import java.util.TreeSet;
+/**
+ *
+ * @author snjeza
+ *
+ */
public class TutorialCategory implements Comparable<TutorialCategory> {
13 years, 3 months
JBoss Tools SVN: r35691 - in trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui: dialogs and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2011-10-16 17:09:55 -0400 (Sun, 16 Oct 2011)
New Revision: 35691
Added:
trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/dialogs/DownloadRuntimeDialog.java
trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/dialogs/DownloadRuntimeViewerDialog.java
Modified:
trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/actions/DownloadRuntimeAction.java
trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/preferences/RuntimePreferencePage.java
Log:
JBIDE-9368 Dashboard(s) for easy news aggregation, twitter and easy additional/3rd party plugin installation and project template/creation
Modified: trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/actions/DownloadRuntimeAction.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/actions/DownloadRuntimeAction.java 2011-10-16 20:40:50 UTC (rev 35690)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/actions/DownloadRuntimeAction.java 2011-10-16 21:09:55 UTC (rev 35691)
@@ -1,35 +1,29 @@
+/*************************************************************************************
+ * Copyright (c) 2010-2011 Red Hat, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
package org.jboss.tools.runtime.ui.actions;
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.net.URL;
-import java.util.List;
-import java.util.Set;
-
import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
-import org.jboss.tools.project.examples.ProjectExamplesActivator;
-import org.jboss.tools.project.examples.filetransfer.ECFExamplesTransport;
-import org.jboss.tools.runtime.core.JBossRuntimeLocator;
import org.jboss.tools.runtime.core.RuntimeCoreActivator;
import org.jboss.tools.runtime.core.model.DownloadRuntime;
-import org.jboss.tools.runtime.core.model.IRuntimeDetector;
-import org.jboss.tools.runtime.core.model.RuntimePath;
-import org.jboss.tools.runtime.core.model.ServerDefinition;
-import org.jboss.tools.runtime.ui.RuntimeUIActivator;
+import org.jboss.tools.runtime.ui.dialogs.DownloadRuntimeDialog;
+/**
+ *
+ * @author snjeza
+ *
+ */
public class DownloadRuntimeAction extends Action {
private String runtimeId;
@@ -59,113 +53,17 @@
setRuntimeId(runtimeId);
}
- private void downloadRuntime(final DownloadRuntime runtime) {
- Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
- DirectoryDialog dialog = new DirectoryDialog(shell);
- dialog.setMessage("Select installation directory.");
- //dialog.setFilterPath("");
- final String selectedDirectory = dialog.open();
- if (selectedDirectory != null) {
- Job job = new Job("Download '" + runtime.getName() + "' ...") {
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- return downloadAndInstall(runtime, selectedDirectory, monitor);
- }
- };
- job.setUser(true);
- job.schedule();
- }
- }
-
- private IStatus downloadAndInstall(DownloadRuntime runtime,
- String selectedDirectory, IProgressMonitor monitor) {
- FileInputStream in = null;
- OutputStream out = null;
- try {
- File file = File.createTempFile("JBossRuntime", "tmp");
- file.deleteOnExit();
- out = new BufferedOutputStream(
- new FileOutputStream(file));
- URL url = new URL(runtime.getUrl());
- String name = url.getPath();
- int slashIdx = name.lastIndexOf('/');
- if (slashIdx >= 0)
- name = name.substring(slashIdx + 1);
-
- IStatus result = ECFExamplesTransport.getInstance().download(name,
- url.toExternalForm(), out, monitor);
- out.flush();
- out.close();
- File directory = new File(selectedDirectory);
- directory.mkdirs();
- if (!directory.isDirectory()) {
- RuntimeCoreActivator.getDefault().getLog().log(result);
- // FIXME
- return Status.CANCEL_STATUS;
- }
- ProjectExamplesActivator.extractZipFile(file, directory, monitor);
- if (!result.isOK()) {
- RuntimeCoreActivator.getDefault().getLog().log(result);
- // FIXME
- return Status.CANCEL_STATUS;
- }
- createRuntimes(selectedDirectory, monitor);
- } catch (IOException e) {
- RuntimeCoreActivator.log(e);
- // FIXME
- } finally {
- if (in != null) {
- try {
- in.close();
- } catch (IOException e) {
- // ignore
- }
- }
- if (out != null) {
- try {
- out.close();
- } catch (IOException e) {
- // ignore
- }
- }
- }
- return Status.OK_STATUS;
- }
-
- private static void createRuntimes(String directory, IProgressMonitor monitor) {
- JBossRuntimeLocator locator = new JBossRuntimeLocator();
- Set<RuntimePath> runtimePaths = RuntimeUIActivator.getDefault()
- .getRuntimePaths();
- RuntimePath newPath = new RuntimePath(directory);
- runtimePaths.add(newPath);
- for (RuntimePath runtimePath : runtimePaths) {
- List<ServerDefinition> serverDefinitions = locator
- .searchForRuntimes(runtimePath.getPath(),
- monitor);
- runtimePath.getServerDefinitions().clear();
- for (ServerDefinition serverDefinition : serverDefinitions) {
- serverDefinition.setRuntimePath(runtimePath);
- }
- runtimePath.getServerDefinitions().addAll(serverDefinitions);
- }
- List<ServerDefinition> serverDefinitions = RuntimeUIActivator
- .getDefault().getServerDefinitions();
- Set<IRuntimeDetector> detectors = RuntimeCoreActivator
- .getRuntimeDetectors();
- for (IRuntimeDetector detector : detectors) {
- if (detector.isEnabled()) {
- detector.initializeRuntimes(serverDefinitions);
- }
- }
- }
-
@Override
public void run() {
Assert.isNotNull(runtimeId);
DownloadRuntime runtime = RuntimeCoreActivator.getDefault().getDownloadJBossRuntimes().get(runtimeId);
- Assert.isNotNull(runtime);
- downloadRuntime(runtime);
+ DownloadRuntimeDialog dialog = new DownloadRuntimeDialog(getShell(), runtime);
+ dialog.open();
}
+ private Shell getShell() {
+ return PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+
+ }
+
}
Added: trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/dialogs/DownloadRuntimeDialog.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/dialogs/DownloadRuntimeDialog.java (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/dialogs/DownloadRuntimeDialog.java 2011-10-16 21:09:55 UTC (rev 35691)
@@ -0,0 +1,364 @@
+/*************************************************************************************
+ * Copyright (c) 2010-2011 Red Hat, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.runtime.ui.dialogs;
+
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.net.URL;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.jboss.tools.project.examples.ProjectExamplesActivator;
+import org.jboss.tools.project.examples.filetransfer.ECFExamplesTransport;
+import org.jboss.tools.runtime.core.JBossRuntimeLocator;
+import org.jboss.tools.runtime.core.RuntimeCoreActivator;
+import org.jboss.tools.runtime.core.model.DownloadRuntime;
+import org.jboss.tools.runtime.core.model.IRuntimeDetector;
+import org.jboss.tools.runtime.core.model.RuntimePath;
+import org.jboss.tools.runtime.core.model.ServerDefinition;
+import org.jboss.tools.runtime.ui.RuntimeUIActivator;
+
+/**
+ * @author snjeza
+ *
+ */
+public class DownloadRuntimeDialog extends Dialog {
+
+ private static final String DELETE_ON_EXIT = "deleteOnExit";
+ private static final String JAVA_IO_TMPDIR = "java.io.tmpdir";
+ private static final String USER_HOME = "user.home";
+ private static final String DEFAULT_DIALOG_PATH = "defaultDialogPath";
+ private static final String DEFAULT_DESTINATION_PATH = "defaultDestinationPath";
+ private IDialogSettings dialogSettings;
+ private Button deleteOnExit;
+ private Text destinationPathText;
+ private Text pathText;
+ private DownloadRuntime downloadRuntime;
+ private String delete;
+
+ public DownloadRuntimeDialog(Shell parentShell, DownloadRuntime downloadRuntime) {
+ super(parentShell);
+ setShellStyle(SWT.CLOSE | SWT.MAX | SWT.TITLE | SWT.BORDER
+ | SWT.RESIZE | getDefaultOrientation());
+ dialogSettings = RuntimeUIActivator.getDefault().getDialogSettings();
+ this.downloadRuntime = downloadRuntime;
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ getShell().setText("Download Runtime '" + downloadRuntime.getName() + "'");
+ Composite area = (Composite) super.createDialogArea(parent);
+ Composite contents = new Composite(area, SWT.NONE);
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ //gd.heightHint = 200;
+ gd.widthHint = 600;
+ contents.setLayoutData(gd);
+ contents.setLayout(new GridLayout(1, false));
+ applyDialogFont(contents);
+ initializeDialogUnits(area);
+
+ Composite pathComposite = new Composite(contents, SWT.NONE);
+ gd = new GridData(SWT.FILL, SWT.FILL, true, false);
+ pathComposite.setLayoutData(gd);
+ pathComposite.setLayout(new GridLayout(3, false));
+
+
+ Label pathLabel = new Label(pathComposite, SWT.NONE);
+ pathLabel.setText("Installation directory:");
+
+ pathText = new Text(pathComposite, SWT.BORDER);
+ gd = new GridData(SWT.FILL, SWT.FILL, true, false);
+ pathText.setLayoutData(gd);
+ String defaultPath = dialogSettings.get(DEFAULT_DIALOG_PATH);
+ if (defaultPath == null || defaultPath.isEmpty()) {
+ defaultPath=System.getProperty(USER_HOME);
+ }
+ pathText.setText(defaultPath);
+ pathText.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ validate();
+ }
+ });
+
+ Button browseButton = new Button(pathComposite, SWT.NONE);
+ browseButton.setText("Browse...");
+ browseButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ DirectoryDialog dialog = new DirectoryDialog(getShell());
+ dialog.setMessage("Select installation directory");
+ dialog.setFilterPath(pathText.getText());
+ final String path = dialog.open();
+ if (path == null) {
+ return;
+ }
+ pathText.setText(path);
+ }
+
+ });
+
+ Label destinationLabel = new Label(pathComposite, SWT.NONE);
+ destinationLabel.setText("Destination directory:");
+
+ destinationPathText = new Text(pathComposite, SWT.BORDER);
+ gd = new GridData(SWT.FILL, SWT.FILL, true, false);
+ destinationPathText.setLayoutData(gd);
+ String destinationPath = dialogSettings.get(DEFAULT_DESTINATION_PATH);
+ if (destinationPath == null || destinationPath.isEmpty()) {
+ destinationPath=System.getProperty(JAVA_IO_TMPDIR);
+ }
+ destinationPathText.setText(destinationPath);
+
+ Button browseDestinationButton = new Button(pathComposite, SWT.NONE);
+ browseDestinationButton.setText("Browse...");
+ browseDestinationButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ DirectoryDialog dialog = new DirectoryDialog(getShell());
+ dialog.setMessage("Select destination directory");
+ dialog.setFilterPath(destinationPathText.getText());
+ final String path = dialog.open();
+ if (path == null) {
+ return;
+ }
+ destinationPathText.setText(path);
+ }
+
+ });
+
+ destinationPathText.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ validate();
+ }
+ });
+
+ deleteOnExit = new Button(pathComposite, SWT.CHECK);
+ deleteOnExit.setText("Delete archive after installing");
+
+ delete = dialogSettings.get(DELETE_ON_EXIT);
+ if (delete == null) {
+ delete = "true";
+ }
+ deleteOnExit.setSelection(new Boolean(delete));
+ deleteOnExit.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ delete = new Boolean(deleteOnExit.getSelection()).toString();
+ }
+
+ });
+
+ return area;
+ }
+
+ protected void validate() {
+ getButton(IDialogConstants.OK_ID).setEnabled(true);
+ if (pathText.getText().isEmpty()) {
+ getButton(IDialogConstants.OK_ID).setEnabled(false);
+ }
+ if (destinationPathText.getText().isEmpty()) {
+ getButton(IDialogConstants.OK_ID).setEnabled(false);
+ }
+ }
+
+ @Override
+ protected void okPressed() {
+ dialogSettings.put(DEFAULT_DESTINATION_PATH,
+ destinationPathText.getText());
+ dialogSettings.put(DEFAULT_DIALOG_PATH, pathText.getText());
+ dialogSettings.put(DELETE_ON_EXIT, delete);
+ String selectedDirectory = pathText.getText();
+ String destinationDirectory = destinationPathText.getText();
+ boolean del = deleteOnExit.getSelection();
+ super.okPressed();
+ downloadRuntime(selectedDirectory, destinationDirectory, del);
+ }
+
+ private void downloadRuntime(final String selectedDirectory,
+ final String destinationDirectory, final boolean deleteOnExit) {
+ final ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell());
+ dialog.setBlockOnOpen(false);
+ dialog.setCancelable(true);
+ dialog.open();
+ final IProgressMonitor monitor = dialog.getProgressMonitor();
+ monitor.beginTask("Download '" + downloadRuntime.getName() + "' ...", 100);
+
+ IRunnableWithProgress runnable = new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor) {
+ downloadAndInstall(selectedDirectory,
+ destinationDirectory, deleteOnExit, monitor);
+ }
+ };
+ try {
+ dialog.run(true, true, runnable);
+ } catch (Exception e) {
+ RuntimeCoreActivator.log(e);
+ MessageDialog.openError(getActiveShell(), "Error", e.getMessage());
+ }
+ }
+
+ private IStatus downloadAndInstall(String selectedDirectory, String destinationDirectory, boolean deleteOnExit, IProgressMonitor monitor) {
+ FileInputStream in = null;
+ OutputStream out = null;
+ File file = null;
+ try {
+ URL url = new URL(downloadRuntime.getUrl());
+ String name = url.getPath();
+ int slashIdx = name.lastIndexOf('/');
+ if (slashIdx >= 0)
+ name = name.substring(slashIdx + 1);
+
+ File destination = new File(destinationDirectory);
+ destination.mkdirs();
+ file = new File (destination, name);
+ int i = 1;
+ while (file.exists()) {
+ file = new File(destination, name + "(" + i++ + ")");
+ }
+
+ if (deleteOnExit) {
+ file.deleteOnExit();
+ }
+ out = new BufferedOutputStream(
+ new FileOutputStream(file));
+
+ IStatus result = ECFExamplesTransport.getInstance().download(file.getName(),
+ url.toExternalForm(), out, monitor);
+ out.flush();
+ out.close();
+ if (monitor.isCanceled()) {
+ file.deleteOnExit();
+ file.delete();
+ return Status.CANCEL_STATUS;
+ }
+ File directory = new File(selectedDirectory);
+ directory.mkdirs();
+ if (!directory.isDirectory()) {
+ RuntimeCoreActivator.getDefault().getLog().log(result);
+ MessageDialog.openError(getActiveShell(), "Error", "The '" + directory + "' is not a directory.");
+ file.deleteOnExit();
+ file.delete();
+ return Status.CANCEL_STATUS;
+ }
+ ProjectExamplesActivator.extractZipFile(file, directory, monitor);
+ if (!result.isOK()) {
+ RuntimeCoreActivator.getDefault().getLog().log(result);
+ String message;
+ if (result.getException() != null) {
+ message = result.getException().getMessage();
+ } else {
+ message = result.getMessage();
+ }
+ MessageDialog.openError(getActiveShell(), "Error", message);
+ file.deleteOnExit();
+ file.delete();
+ return Status.CANCEL_STATUS;
+ }
+ createRuntimes(selectedDirectory, monitor);
+ } catch (IOException e) {
+ RuntimeCoreActivator.log(e);
+ if (file != null && file.exists()) {
+ file.deleteOnExit();
+ file.delete();
+ }
+ MessageDialog.openError(getActiveShell(), "Error", e.getMessage());
+ } finally {
+ if (in != null) {
+ try {
+ in.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ if (out != null) {
+ try {
+ out.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ private Shell getActiveShell() {
+ Display display = Display.getDefault();
+ if (display != null) {
+ return display.getActiveShell();
+ }
+ return null;
+ }
+
+ private static void createRuntimes(String directory, IProgressMonitor monitor) {
+ JBossRuntimeLocator locator = new JBossRuntimeLocator();
+ Set<RuntimePath> runtimePaths = RuntimeUIActivator.getDefault()
+ .getRuntimePaths();
+ RuntimePath newPath = new RuntimePath(directory);
+ runtimePaths.add(newPath);
+ for (RuntimePath runtimePath : runtimePaths) {
+ List<ServerDefinition> serverDefinitions = locator
+ .searchForRuntimes(runtimePath.getPath(),
+ monitor);
+ runtimePath.getServerDefinitions().clear();
+ for (ServerDefinition serverDefinition : serverDefinitions) {
+ serverDefinition.setRuntimePath(runtimePath);
+ }
+ runtimePath.getServerDefinitions().addAll(serverDefinitions);
+ RuntimeUIActivator.getDefault().getRuntimePaths().add(runtimePath);
+ RuntimeUIActivator.getDefault().saveRuntimePaths();
+ }
+ List<ServerDefinition> serverDefinitions = RuntimeUIActivator
+ .getDefault().getServerDefinitions();
+ Set<IRuntimeDetector> detectors = RuntimeCoreActivator
+ .getRuntimeDetectors();
+ for (IRuntimeDetector detector : detectors) {
+ if (detector.isEnabled()) {
+ detector.initializeRuntimes(serverDefinitions);
+ }
+ }
+ }
+
+}
Added: trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/dialogs/DownloadRuntimeViewerDialog.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/dialogs/DownloadRuntimeViewerDialog.java (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/dialogs/DownloadRuntimeViewerDialog.java 2011-10-16 21:09:55 UTC (rev 35691)
@@ -0,0 +1,188 @@
+/*************************************************************************************
+ * Copyright (c) 2010-2011 Red Hat, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.runtime.ui.dialogs;
+
+import java.util.Map;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.viewers.ColumnLabelProvider;
+import org.eclipse.jface.viewers.ColumnLayoutData;
+import org.eclipse.jface.viewers.ColumnWeightData;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITreeSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TableLayout;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TableViewerColumn;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.jboss.tools.runtime.core.RuntimeCoreActivator;
+import org.jboss.tools.runtime.core.model.DownloadRuntime;
+
+/**
+ * @author snjeza
+ *
+ */
+public class DownloadRuntimeViewerDialog extends Dialog {
+
+ private TableViewer viewer;
+ private Map<String, DownloadRuntime> downloadRuntimes;
+
+ public DownloadRuntimeViewerDialog(Shell parentShell) {
+ super(parentShell);
+ setShellStyle(SWT.CLOSE | SWT.MAX | SWT.TITLE | SWT.BORDER
+ | SWT.RESIZE | getDefaultOrientation());
+ downloadRuntimes = RuntimeCoreActivator.getDefault().getDownloadJBossRuntimes();
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ getShell().setText("Runtimes");
+ Composite area = (Composite) super.createDialogArea(parent);
+ area.setLayout(new GridLayout());
+ Composite contents = new Composite(area, SWT.NONE);
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ contents.setLayoutData(gd);
+ contents.setLayout(new GridLayout(1, false));
+ applyDialogFont(contents);
+ initializeDialogUnits(area);
+
+ viewer = new TableViewer(parent, SWT.SINGLE | SWT.FULL_SELECTION | SWT.H_SCROLL
+ | SWT.V_SCROLL | SWT.BORDER);
+ gd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ gd.heightHint = 400;
+ gd.widthHint = 700;
+ viewer.getTable().setLayoutData(gd);
+
+ Table table = viewer.getTable();
+ table.setHeaderVisible(true);
+ table.setLinesVisible(true);
+ table.setFont(parent.getFont());
+
+ viewer.setContentProvider(new DownloadRuntimesContentProvider());
+
+ //String[] columnHeaders = {"Name", "ID", "Version", "URL"};
+ String[] columnHeaders = {"Name", "ID", "Version"};
+ for (int i = 0; i < columnHeaders.length; i++) {
+ TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE);
+ column.setLabelProvider(new DownloadRuntimesLabelProvider(i));
+ column.getColumn().setText(columnHeaders[i]);
+ column.getColumn().setResizable(true);
+ column.getColumn().setMoveable(true);
+ }
+
+ ColumnLayoutData[] runtimePathsLayouts= {
+ new ColumnWeightData(250,250),
+ new ColumnWeightData(200,200),
+ new ColumnWeightData(150,150),
+
+ };
+
+ TableLayout layout = new AutoResizeTableLayout(table);
+ for (int i = 0; i < runtimePathsLayouts.length; i++) {
+ layout.addColumnData(runtimePathsLayouts[i]);
+ }
+
+ viewer.setInput(downloadRuntimes);
+ if (downloadRuntimes.values().size() > 0) {
+ viewer.getTable().select(0);
+ }
+ viewer.getTable().setLayout(layout);
+ viewer.addSelectionChangedListener(new ISelectionChangedListener() {
+
+ @Override
+ public void selectionChanged(SelectionChangedEvent event) {
+ validate();
+ }
+ });
+ return area;
+ }
+
+ class DownloadRuntimesContentProvider implements IStructuredContentProvider {
+
+ @Override
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+
+ }
+
+ @Override
+ public Object[] getElements(Object inputElement) {
+ return downloadRuntimes.values().toArray(new DownloadRuntime[0]);
+ }
+
+ @Override
+ public void dispose() {
+
+ }
+ }
+
+ class DownloadRuntimesLabelProvider extends ColumnLabelProvider {
+
+ private int columnIndex;
+
+ public DownloadRuntimesLabelProvider(int i) {
+ this.columnIndex = i;
+ }
+
+ public String getText(Object element) {
+ if (element instanceof DownloadRuntime) {
+ DownloadRuntime downloadRuntime = (DownloadRuntime) element;
+ switch (columnIndex) {
+ case 0:
+ return downloadRuntime.getName();
+ case 1:
+ return downloadRuntime.getId();
+ case 2:
+ return downloadRuntime.getVersion();
+ case 3:
+ return downloadRuntime.getUrl();
+ }
+ }
+ return null;
+ }
+ }
+
+ @Override
+ protected void okPressed() {
+ ISelection selection = viewer.getSelection();
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection structuredSelection = (IStructuredSelection) selection;
+ Object object = structuredSelection.getFirstElement();
+ if (object instanceof DownloadRuntime) {
+ DownloadRuntime downloadRuntime = (DownloadRuntime) object;
+ DownloadRuntimeDialog dialog = new DownloadRuntimeDialog(getShell(), downloadRuntime);
+ dialog.open();
+ }
+ }
+ super.okPressed();
+ }
+
+ @Override
+ protected void createButtonsForButtonBar(Composite parent) {
+ super.createButtonsForButtonBar(parent);
+ validate();
+ }
+
+ protected void validate() {
+ getButton(IDialogConstants.OK_ID).setEnabled(viewer.getSelection() != null);
+ }
+
+}
Modified: trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/preferences/RuntimePreferencePage.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/preferences/RuntimePreferencePage.java 2011-10-16 20:40:50 UTC (rev 35690)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/preferences/RuntimePreferencePage.java 2011-10-16 21:09:55 UTC (rev 35691)
@@ -73,6 +73,8 @@
import org.jboss.tools.runtime.core.model.RuntimePath;
import org.jboss.tools.runtime.ui.RuntimeUIActivator;
import org.jboss.tools.runtime.ui.dialogs.AutoResizeTableLayout;
+import org.jboss.tools.runtime.ui.dialogs.DownloadRuntimeDialog;
+import org.jboss.tools.runtime.ui.dialogs.DownloadRuntimeViewerDialog;
import org.jboss.tools.runtime.ui.dialogs.EditRuntimePathDialog;
import org.jboss.tools.runtime.ui.dialogs.RuntimePathEditingSupport;
@@ -93,6 +95,7 @@
private Set<IRuntimeDetector> runtimeDetectors;
private TableViewer detectorViewer;
private Button searchButton;
+ private Button downloadButton;
/*
* (non-Javadoc)
@@ -404,6 +407,22 @@
}
});
+ downloadButton = new Button(buttonComposite, SWT.PUSH);
+ downloadButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ downloadButton.setText("Download...");
+
+ downloadButton.addSelectionListener(new SelectionListener(){
+
+ public void widgetSelected(SelectionEvent e) {
+ DownloadRuntimeViewerDialog dialog = new DownloadRuntimeViewerDialog(getShell());
+ dialog.open();
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+
+ }
+ });
+
viewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
13 years, 3 months
JBoss Tools SVN: r35690 - trunk/documentation/guides/GettingStartedGuide/en-US.
by jbosstools-commits@lists.jboss.org
Author: irooskov(a)redhat.com
Date: 2011-10-16 16:40:50 -0400 (Sun, 16 Oct 2011)
New Revision: 35690
Modified:
trunk/documentation/guides/GettingStartedGuide/en-US/gsg_faq.xml
Log:
updated for TOOLSDOC-249
Modified: trunk/documentation/guides/GettingStartedGuide/en-US/gsg_faq.xml
===================================================================
--- trunk/documentation/guides/GettingStartedGuide/en-US/gsg_faq.xml 2011-10-16 20:40:35 UTC (rev 35689)
+++ trunk/documentation/guides/GettingStartedGuide/en-US/gsg_faq.xml 2011-10-16 20:40:50 UTC (rev 35690)
@@ -48,7 +48,7 @@
</listitem>
<listitem>
- <para>Open the file <filename>eclipse.ini</filename>, which can be found in your Fedora Eclipse location and add the following line: </para>
+ <para>Open the file <filename>jbdevstudio.ini</filename>, which can be found in your Fedora Eclipse location and add the following line: </para>
<programlisting role="JAVA"><![CDATA[-Dswt.library.path=/usr/lib/eclipse]]></programlisting>
<para>,where <code>/usr/lib/eclipse</code> is the path to your eclipse folder.</para>
</listitem>
@@ -165,7 +165,7 @@
<title>Is it possible to increase the performance of Eclipse after installing your product?</title>
<para>
- <property>JBoss Developer Studio</property> configures eclipse via the <filename>eclipse.ini</filename> file to allocate extra memory, but if you for some reason need more memory then by default, you can manually make adjustments in this file. For example:</para>
+ <property>JBoss Developer Studio</property> configures eclipse via the <filename>jbdevstudio.ini</filename> file to allocate extra memory, but if you for some reason need more memory then by default, you can manually make adjustments in this file. For example:</para>
<programlisting role="XML"><![CDATA[-vmargs -Xms128m -Xmx512m -XX:MaxPermSize=128m]]></programlisting>
</section>
13 years, 3 months
JBoss Tools SVN: r35689 - branches/jbosstools-3.2.x/documentation/guides/GettingStartedGuide/en-US.
by jbosstools-commits@lists.jboss.org
Author: irooskov(a)redhat.com
Date: 2011-10-16 16:40:35 -0400 (Sun, 16 Oct 2011)
New Revision: 35689
Modified:
branches/jbosstools-3.2.x/documentation/guides/GettingStartedGuide/en-US/gsg_faq.xml
Log:
updated for TOOLSDOC-249
Modified: branches/jbosstools-3.2.x/documentation/guides/GettingStartedGuide/en-US/gsg_faq.xml
===================================================================
--- branches/jbosstools-3.2.x/documentation/guides/GettingStartedGuide/en-US/gsg_faq.xml 2011-10-16 20:37:16 UTC (rev 35688)
+++ branches/jbosstools-3.2.x/documentation/guides/GettingStartedGuide/en-US/gsg_faq.xml 2011-10-16 20:40:35 UTC (rev 35689)
@@ -48,7 +48,7 @@
</listitem>
<listitem>
- <para>Open the file <filename>eclipse.ini</filename>, which can be found in your Fedora Eclipse location and add the following line: </para>
+ <para>Open the file <filename>jbdevstudio.ini</filename>, which can be found in your Fedora Eclipse location and add the following line: </para>
<programlisting role="JAVA"><![CDATA[-Dswt.library.path=/usr/lib/eclipse]]></programlisting>
<para>,where <code>/usr/lib/eclipse</code> is the path to your eclipse folder.</para>
</listitem>
@@ -165,7 +165,7 @@
<title>Is it possible to increase the performance of Eclipse after installing your product?</title>
<para>
- <property>JBoss Developer Studio</property> configures eclipse via the <filename>eclipse.ini</filename> file to allocate extra memory, but if you for some reason need more memory then by default, you can manually make adjustments in this file. For example:</para>
+ <property>JBoss Developer Studio</property> configures eclipse via the <filename>jbdevstudio.ini</filename> file to allocate extra memory, but if you for some reason need more memory then by default, you can manually make adjustments in this file. For example:</para>
<programlisting role="XML"><![CDATA[-vmargs -Xms128m -Xmx512m -XX:MaxPermSize=128m]]></programlisting>
</section>
13 years, 3 months
JBoss Tools SVN: r35688 - branches/jbosstools-3.2.x/documentation/guides/GettingStartedGuide/en-US.
by jbosstools-commits@lists.jboss.org
Author: irooskov(a)redhat.com
Date: 2011-10-16 16:37:16 -0400 (Sun, 16 Oct 2011)
New Revision: 35688
Modified:
branches/jbosstools-3.2.x/documentation/guides/GettingStartedGuide/en-US/Book_Info.xml
Log:
updated for brew
Modified: branches/jbosstools-3.2.x/documentation/guides/GettingStartedGuide/en-US/Book_Info.xml
===================================================================
--- branches/jbosstools-3.2.x/documentation/guides/GettingStartedGuide/en-US/Book_Info.xml 2011-10-15 21:25:01 UTC (rev 35687)
+++ branches/jbosstools-3.2.x/documentation/guides/GettingStartedGuide/en-US/Book_Info.xml 2011-10-16 20:37:16 UTC (rev 35688)
@@ -8,7 +8,7 @@
<productname>JBoss Developer Studio</productname>
<productnumber>4.1</productnumber>
<edition>4.1.1</edition>
-<pubsnumber>19</pubsnumber>
+<pubsnumber>20</pubsnumber>
<abstract>
<para>The Getting Started Guide explains the JBoss Developer Studio.</para>
</abstract>
13 years, 3 months
JBoss Tools SVN: r35687 - in trunk/central/plugins/org.jboss.tools.central: icons and 5 other directories.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2011-10-15 17:25:01 -0400 (Sat, 15 Oct 2011)
New Revision: 35687
Added:
trunk/central/plugins/org.jboss.tools.central/icons/blogs.gif
trunk/central/plugins/org.jboss.tools.central/icons/feedsLink.gif
trunk/central/plugins/org.jboss.tools.central/icons/news.png
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/OpenJBossBlogsHandler.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/RefreshJBossBlogsHandler.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/FeedsToolTip.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/jobs/RefreshBlogsJob.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/model/FeedsEntry.java
Removed:
trunk/central/plugins/org.jboss.tools.central/icons/news.gif
trunk/central/plugins/org.jboss.tools.central/icons/news.png
trunk/central/plugins/org.jboss.tools.central/icons/newsLink.gif
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/OpenJBossNewsHandler.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/RefreshJBossNewsHandler.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/NewsToolTip.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/jobs/RefreshNewsJob.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/model/NewsEntry.java
Modified:
trunk/central/plugins/org.jboss.tools.central/plugin.xml
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/JBossCentralActivator.java
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/JBossCentralEditor.java
Log:
JBIDE-9653 Add RSS feed(s) in to JBoss Central
Copied: trunk/central/plugins/org.jboss.tools.central/icons/blogs.gif (from rev 35631, trunk/central/plugins/org.jboss.tools.central/icons/news.gif)
===================================================================
(Binary files differ)
Copied: trunk/central/plugins/org.jboss.tools.central/icons/feedsLink.gif (from rev 35631, trunk/central/plugins/org.jboss.tools.central/icons/newsLink.gif)
===================================================================
(Binary files differ)
Deleted: trunk/central/plugins/org.jboss.tools.central/icons/news.gif
===================================================================
(Binary files differ)
Deleted: trunk/central/plugins/org.jboss.tools.central/icons/news.png
===================================================================
(Binary files differ)
Added: trunk/central/plugins/org.jboss.tools.central/icons/news.png
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/icons/news.png (rev 0)
+++ trunk/central/plugins/org.jboss.tools.central/icons/news.png 2011-10-15 21:25:01 UTC (rev 35687)
@@ -0,0 +1,9 @@
+�PNG
+
+
+�c�m��K���mv.�&�$N&{ț���_�qO}���X0Hf�3���$����v�l���0�c/�w�����wNP��:�����C�B�ҧ
\ No newline at end of file
Deleted: trunk/central/plugins/org.jboss.tools.central/icons/newsLink.gif
===================================================================
(Binary files differ)
Modified: trunk/central/plugins/org.jboss.tools.central/plugin.xml
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/plugin.xml 2011-10-15 20:40:57 UTC (rev 35686)
+++ trunk/central/plugins/org.jboss.tools.central/plugin.xml 2011-10-15 21:25:01 UTC (rev 35687)
@@ -57,9 +57,9 @@
</command>
<command
- defaultHandler="org.jboss.tools.central.actions.OpenJBossNewsHandler"
- name="News"
- id="org.jboss.tools.central.openJBossNews">
+ defaultHandler="org.jboss.tools.central.actions.OpenJBossBlogsHandler"
+ name="Blogs"
+ id="org.jboss.tools.central.openJBossBlogs">
</command>
<command
@@ -68,9 +68,9 @@
id="org.jboss.tools.central.refreshJBossTutorials">
</command>
<command
- defaultHandler="org.jboss.tools.central.actions.RefreshJBossNewsHandler"
+ defaultHandler="org.jboss.tools.central.actions.RefreshJBossBlogsHandler"
name="Refresh"
- id="org.jboss.tools.central.refreshJBossNews">
+ id="org.jboss.tools.central.refreshJBossBlogs">
</command>
<command
defaultHandler="org.jboss.tools.central.actions.RefreshDiscoveryHandler"
@@ -131,11 +131,11 @@
icon="icons/jbosstools_icon16.png">
</image>
<image
- commandId="org.jboss.tools.central.openJBossNews"
- icon="icons/news.gif">
+ commandId="org.jboss.tools.central.openJBossBlogs"
+ icon="icons/blogs.gif">
</image>
<image
- commandId="org.jboss.tools.central.refreshJBossNews"
+ commandId="org.jboss.tools.central.refreshJBossBlogs"
icon="icons/refresh.gif">
</image>
<image
Modified: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/JBossCentralActivator.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/JBossCentralActivator.java 2011-10-15 20:40:57 UTC (rev 35686)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/JBossCentralActivator.java 2011-10-15 21:25:01 UTC (rev 35687)
@@ -103,10 +103,14 @@
public static final String NEW_PROJECT_EXAMPLES_WIZARD_ID = "org.jboss.tools.project.examples.wizard.NewProjectExamplesWizard";
- public static final String NEWS_URL = "http://planet.jboss.org/feeds/blogs";
+ public static final String BLOG_URL = "http://planet.jboss.org/feeds/blogs";
- public static final String NEWS_ATOM_URL = "http://planet.jboss.org/feeds/blogs";
+ public static final String BLOGS_ATOM_URL = "http://planet.jboss.org/feeds/blogs";
+
+ public static final String NEWS_URL = "http://pipes.yahoo.com/pipes/pipe.run?_id=660682be8ddf4b5db0cce318826f8a53";
+ public static final String NEWS_ATOM_URL = "http://pipes.yahoo.com/pipes/pipe.run?_id=660682be8ddf4b5db0cce318826f8a5...";
+
public static final String FORM_END_TAG = "</p></form>";
public static final String FORM_START_TAG = "<form><p>";
public static final String CANCELED = FORM_START_TAG + "<span color=\"header\" font=\"header\">Canceled.</span>" + FORM_END_TAG;
Copied: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/OpenJBossBlogsHandler.java (from rev 35631, trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/OpenJBossNewsHandler.java)
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/OpenJBossBlogsHandler.java (rev 0)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/OpenJBossBlogsHandler.java 2011-10-15 21:25:01 UTC (rev 35687)
@@ -0,0 +1,28 @@
+/*************************************************************************************
+ * Copyright (c) 2008-2011 Red Hat, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+
+package org.jboss.tools.central.actions;
+
+import org.jboss.tools.central.JBossCentralActivator;
+
+/**
+ *
+ * @author snjeza
+ *
+ */
+public class OpenJBossBlogsHandler extends OpenWithBrowserHandler {
+
+ @Override
+ public String getLocation() {
+ return JBossCentralActivator.BLOG_URL;
+ }
+
+}
Deleted: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/OpenJBossNewsHandler.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/OpenJBossNewsHandler.java 2011-10-15 20:40:57 UTC (rev 35686)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/OpenJBossNewsHandler.java 2011-10-15 21:25:01 UTC (rev 35687)
@@ -1,28 +0,0 @@
-/*************************************************************************************
- * Copyright (c) 2008-2011 Red Hat, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * JBoss by Red Hat - Initial implementation.
- ************************************************************************************/
-
-package org.jboss.tools.central.actions;
-
-import org.jboss.tools.central.JBossCentralActivator;
-
-/**
- *
- * @author snjeza
- *
- */
-public class OpenJBossNewsHandler extends OpenWithBrowserHandler {
-
- @Override
- public String getLocation() {
- return JBossCentralActivator.NEWS_URL;
- }
-
-}
Copied: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/RefreshJBossBlogsHandler.java (from rev 35631, trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/RefreshJBossNewsHandler.java)
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/RefreshJBossBlogsHandler.java (rev 0)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/RefreshJBossBlogsHandler.java 2011-10-15 21:25:01 UTC (rev 35687)
@@ -0,0 +1,35 @@
+/*************************************************************************************
+ * Copyright (c) 2008-2011 Red Hat, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+
+package org.jboss.tools.central.actions;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.jobs.Job;
+import org.jboss.tools.central.jobs.RefreshBlogsJob;
+
+/**
+ *
+ * @author snjeza
+ *
+ */
+public class RefreshJBossBlogsHandler extends AbstractHandler {
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ if (RefreshBlogsJob.INSTANCE.getState() == Job.NONE) {
+ RefreshBlogsJob.INSTANCE.schedule();
+ }
+ return null;
+ }
+
+}
Deleted: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/RefreshJBossNewsHandler.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/RefreshJBossNewsHandler.java 2011-10-15 20:40:57 UTC (rev 35686)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/RefreshJBossNewsHandler.java 2011-10-15 21:25:01 UTC (rev 35687)
@@ -1,35 +0,0 @@
-/*************************************************************************************
- * Copyright (c) 2008-2011 Red Hat, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * JBoss by Red Hat - Initial implementation.
- ************************************************************************************/
-
-package org.jboss.tools.central.actions;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.jobs.Job;
-import org.jboss.tools.central.jobs.RefreshNewsJob;
-
-/**
- *
- * @author snjeza
- *
- */
-public class RefreshJBossNewsHandler extends AbstractHandler {
-
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- if (RefreshNewsJob.INSTANCE.getState() == Job.NONE) {
- RefreshNewsJob.INSTANCE.schedule();
- }
- return null;
- }
-
-}
Copied: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/FeedsToolTip.java (from rev 35658, trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/NewsToolTip.java)
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/FeedsToolTip.java (rev 0)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/FeedsToolTip.java 2011-10-15 21:25:01 UTC (rev 35687)
@@ -0,0 +1,212 @@
+/*************************************************************************************
+ * Copyright (c) 2008-2011 Red Hat, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+
+package org.jboss.tools.central.editors;
+
+import org.eclipse.jface.window.ToolTip;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.browser.Browser;
+import org.eclipse.swt.browser.OpenWindowListener;
+import org.eclipse.swt.browser.WindowEvent;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseMoveListener;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.forms.widgets.FormText;
+
+/**
+ *
+ * @author snjeza
+ *
+ */
+public class FeedsToolTip extends ToolTip {
+
+ private String toolText;
+ private static Shell CURRENT_TOOLTIP;
+ private Label hintLabel;
+ private FormText formText;
+ private int x;
+ private int y;
+ private boolean focused = false;
+
+// private Listener deactivateListener = new Listener() {
+//
+// @Override
+// public void handleEvent(Event event) {
+// if (focused) {
+// if (CURRENT_TOOLTIP != null) {
+// CURRENT_TOOLTIP.dispose();
+// CURRENT_TOOLTIP = null;
+// }
+// activate();
+// hide();
+// focused = false;
+// }
+// }
+// };
+
+ private MouseMoveListener mouseMoveListener = new MouseMoveListener() {
+ public void mouseMove(MouseEvent e) {
+ x = e.x;
+ y = e.y;
+ }
+ };
+ private Listener keyListener = new Listener() {
+
+ @Override
+ public void handleEvent(Event e) {
+ if (e == null)
+ return;
+ if (e.keyCode == SWT.ESC) {
+ if (CURRENT_TOOLTIP != null) {
+ CURRENT_TOOLTIP.dispose();
+ CURRENT_TOOLTIP = null;
+ }
+ activate();
+ focused = false;
+ }
+ if (e.keyCode == SWT.F2) {
+ if (CURRENT_TOOLTIP == null) {
+ deactivate();
+ hide();
+ }
+ focused = true;
+ createFocusedTooltip(FeedsToolTip.this.formText);
+ }
+ }
+ };
+
+ public FeedsToolTip(FormText formText, String toolText) {
+ super(formText);
+ this.toolText = "<html>" +
+ "<head>" +
+ "<title>JBoss</title>" +
+ "<style>" +
+ "html, body { font-size: 12px;font-family: Arial, Helvetica, sans-serif; }" +
+ "h1, h2, h3, h4, h5, h6 { font-size: 14px;font-weight:bold;font-family: Arial, Helvetica, sans-serif; }" +
+ "</style>" +
+ "</head>" +
+ "<body>" +
+ toolText +
+ "</body>" +
+ "</html>";
+ this.formText = formText;
+ setShift(new Point(0, 15));
+ setPopupDelay(400);
+ setHideOnMouseDown(true);
+ }
+
+ public void createFocusedTooltip(final Control control) {
+ final Shell stickyTooltip = new Shell(control.getShell(), SWT.ON_TOP | SWT.TOOL
+ | SWT.NO_FOCUS);
+ stickyTooltip.setLayout(new GridLayout());
+ //stickyTooltip.setBackground(stickyTooltip.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
+
+ control.getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ Event event = new Event();
+ event.x = x;
+ event.y = y;
+ event.widget = control;
+
+ createToolTipContentArea(event, stickyTooltip);
+ stickyTooltip.pack();
+
+ stickyTooltip.setLocation(stickyTooltip.getDisplay().getCursorLocation());
+ hintLabel.setText("Press 'ESC' to Hide.");
+ stickyTooltip.setVisible(true);
+ }
+ });
+ CURRENT_TOOLTIP = stickyTooltip;
+ }
+
+ @Override
+ protected Composite createToolTipContentArea(Event event, Composite parent) {
+ if (!focused) {
+ formText.setFocus();
+ }
+// if (formText.getShell() != null) {
+// formText.getShell().addListener(SWT.Deactivate, deactivateListener);
+// }
+ formText.addMouseMoveListener(mouseMoveListener);
+ formText.addListener(SWT.KeyDown, keyListener);
+
+ parent.addDisposeListener(new DisposeListener() {
+
+ @Override
+ public void widgetDisposed(DisposeEvent e) {
+ if (formText != null && !formText.isDisposed()) {
+ formText.removeMouseMoveListener(mouseMoveListener);
+ formText.removeListener(SWT.KeyDown, keyListener);
+// if (formText.getShell() != null && !formText.getShell().isDisposed()) {
+// formText.getShell().removeListener(SWT.Deactivate, deactivateListener);
+// }
+ }
+ }
+ });
+
+
+ parent.setLayout(new GridLayout());
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ parent.setLayoutData(gd);
+
+ Browser browser = new Browser(parent, SWT.NONE);
+ browser.setJavascriptEnabled(false);
+ browser.addOpenWindowListener(new OpenWindowListener() {
+ public void open(WindowEvent event) {
+ event.required= true;
+ }
+ });
+ gd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ gd.heightHint = 150;
+ gd.widthHint = 400;
+ browser.setLayoutData(gd);
+ browser.setText(toolText);
+
+ hintLabel = new Label(parent, SWT.NONE);
+ gd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ hintLabel.setLayoutData(gd);
+ hintLabel.setAlignment(SWT.RIGHT);
+ hintLabel.setBackground(parent.getDisplay().getSystemColor(
+ SWT.COLOR_INFO_BACKGROUND));
+ hintLabel.setText("Press 'F2' for Focus.");
+ hintLabel.setForeground(parent.getDisplay().getSystemColor(
+ SWT.COLOR_DARK_GRAY));
+
+ final Font font;
+ Display display = parent.getDisplay();
+ FontData[] fd = parent.getFont().getFontData();
+ int size2 = fd.length;
+ for (int i = 0; i < size2; i++)
+ fd[i].setHeight(7);
+ font = new Font(display, fd);
+ parent.addDisposeListener(new DisposeListener() {
+ public void widgetDisposed(DisposeEvent e) {
+ font.dispose();
+ }
+ });
+ hintLabel.setFont(font);
+ return parent;
+ }
+
+}
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-10-15 20:40:57 UTC (rev 35686)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/GettingStartedPage.java 2011-10-15 21:25:01 UTC (rev 35687)
@@ -45,7 +45,6 @@
import org.eclipse.jface.window.ToolTip;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.SWTException;
import org.eclipse.swt.custom.BusyIndicator;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.events.ControlAdapter;
@@ -89,9 +88,9 @@
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.jboss.tools.central.JBossCentralActivator;
import org.jboss.tools.central.dialogs.ProjectExamplesDialog;
-import org.jboss.tools.central.jobs.RefreshNewsJob;
+import org.jboss.tools.central.jobs.RefreshBlogsJob;
import org.jboss.tools.central.jobs.RefreshTutorialsJob;
-import org.jboss.tools.central.model.NewsEntry;
+import org.jboss.tools.central.model.FeedsEntry;
import org.jboss.tools.central.model.Tutorial;
import org.jboss.tools.central.model.TutorialCategory;
import org.jboss.tools.project.examples.ProjectExamplesActivator;
@@ -112,22 +111,22 @@
protected static final long TIME_DELAY = 2000L;
private IWorkbenchAction newWizardDropDownAction;
private ScrolledForm form;
- private PageBook newsPageBook;
+ private PageBook blogsPageBook;
private ScrolledComposite scrollComposite;
- private RefreshNewsJobChangeListener refreshNewsJobChangeListener;
- private FormText newsNoteText;
+ private RefreshBlogsJobChangeListener refreshBlogsJobChangeListener;
+ private FormText blogsNoteText;
private FormText tutorialsNoteText;
- private Composite newsLoadingComposite;
+ private Composite blogsLoadingComposite;
private Composite tutorialsLoadingComposite;
- private FormText newsExceptionText;
+ private FormText blogsExceptionText;
private FormText tutorialsExceptionText;
- private Composite newsComposite;
+ private Composite blogsComposite;
private Composite tutorialsComposite;
private FormToolkit toolkit;
private ScrolledComposite tutorialScrollComposite;
private PageBook tutorialPageBook;
private RefreshTutorialsJobChangeListener refreshTutorialsJobChangeListener;
- private Section newsSection;
+ private Section blogsSection;
private Section tutorialsSection;
private Section documentationSection;
private Section projectsSection;
@@ -161,7 +160,7 @@
toolkit.paintBordersFor(left);
Composite right = createComposite(toolkit, body);
- createNewsSection(toolkit, right);
+ createBlogsSection(toolkit, right);
toolkit.paintBordersFor(right);
final ControlAdapter controlAdapter = new ControlAdapter() {
@@ -186,49 +185,43 @@
}
- private void createNewsSection(FormToolkit toolkit, Composite parent) {
- newsSection = createSection(toolkit, parent, "News", ExpandableComposite.TITLE_BAR|ExpandableComposite.EXPANDED);
+ private void createBlogsSection(FormToolkit toolkit, Composite parent) {
+ blogsSection = createSection(toolkit, parent, "Blogs", ExpandableComposite.TITLE_BAR|ExpandableComposite.EXPANDED);
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
//gd.widthHint = 350;
//gd.heightHint = 100;
- newsSection.setLayoutData(gd);
- createNewsToolbar(toolkit, newsSection);
+ blogsSection.setLayoutData(gd);
+ createBlogsToolbar(toolkit, blogsSection);
- scrollComposite = new ScrolledComposite(newsSection, SWT.V_SCROLL);
+ scrollComposite = new ScrolledComposite(blogsSection, SWT.V_SCROLL);
gd =new GridData(SWT.FILL, SWT.FILL, true, false);
scrollComposite.setLayoutData(gd);
scrollComposite.setLayout(new GridLayout());
- newsPageBook = new PageBook(scrollComposite, SWT.WRAP);
+ blogsPageBook = new PageBook(scrollComposite, SWT.WRAP);
gd =new GridData(SWT.FILL, SWT.FILL, true, false);
- newsPageBook.setLayoutData(gd);
+ blogsPageBook.setLayoutData(gd);
- scrollComposite.setContent(newsPageBook);
+ scrollComposite.setContent(blogsPageBook);
scrollComposite.setExpandVertical(true);
scrollComposite.setExpandHorizontal(true);
scrollComposite.setAlwaysShowScrollBars(false);
-// scrollComposite.addControlListener(new ControlAdapter() {
-// public void controlResized(ControlEvent e) {
-// recomputeScrollComposite(scrollComposite, newsPageBook);
-// }
-// });
- newsNoteText = createNoteText(toolkit, newsPageBook);
- newsLoadingComposite = createLoadingComposite(toolkit, newsPageBook);
- newsExceptionText = createExceptionText(toolkit, newsPageBook);
+ blogsNoteText = createNoteText(toolkit, blogsPageBook);
+ blogsLoadingComposite = createLoadingComposite(toolkit, blogsPageBook);
+ blogsExceptionText = createExceptionText(toolkit, blogsPageBook);
- newsComposite = toolkit.createComposite(newsPageBook, SWT.NONE);
- newsComposite.setLayout(new TableWrapLayout());
- GridDataFactory.fillDefaults().grab(true, false).applyTo(newsComposite);
- //newsComposite.setLayoutData(gd);
+ blogsComposite = toolkit.createComposite(blogsPageBook, SWT.NONE);
+ blogsComposite.setLayout(new TableWrapLayout());
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(blogsComposite);
- newsSection.setClient(scrollComposite);
- showLoading(newsPageBook, newsLoadingComposite, scrollComposite);
- newsPageBook.pack(true);
- RefreshNewsJob refreshNewsJob = RefreshNewsJob.INSTANCE;
- refreshNewsJobChangeListener = new RefreshNewsJobChangeListener();
- refreshNewsJob.addJobChangeListener(refreshNewsJobChangeListener);
- refreshNewsJob.schedule();
+ blogsSection.setClient(scrollComposite);
+ showLoading(blogsPageBook, blogsLoadingComposite, scrollComposite);
+ blogsPageBook.pack(true);
+ RefreshBlogsJob refreshBlogsJob = RefreshBlogsJob.INSTANCE;
+ refreshBlogsJobChangeListener = new RefreshBlogsJobChangeListener();
+ refreshBlogsJob.addJobChangeListener(refreshBlogsJobChangeListener);
+ refreshBlogsJob.schedule();
}
private FormText createExceptionText(FormToolkit toolkit, Composite parent) {
@@ -268,7 +261,7 @@
return formText;
}
- private void createNewsToolbar(FormToolkit toolkit, Section section) {
+ private void createBlogsToolbar(FormToolkit toolkit, Section section) {
Composite headerComposite = toolkit.createComposite(section, SWT.NONE);
RowLayout rowLayout = new RowLayout();
rowLayout.marginTop = 0;
@@ -279,10 +272,10 @@
ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT | SWT.HORIZONTAL);
toolBarManager.createControl(headerComposite);
- CommandContributionItem item = JBossCentralActivator.createContributionItem(getSite(), "org.jboss.tools.central.openJBossNews");
+ CommandContributionItem item = JBossCentralActivator.createContributionItem(getSite(), "org.jboss.tools.central.openJBossBlogs");
toolBarManager.add(item);
- item = JBossCentralActivator.createContributionItem(getSite(), "org.jboss.tools.central.refreshJBossNews");
+ item = JBossCentralActivator.createContributionItem(getSite(), "org.jboss.tools.central.refreshJBossBlogs");
toolBarManager.add(item);
toolBarManager.update(true);
@@ -571,9 +564,9 @@
public void dispose() {
newWizardDropDownAction.dispose();
newWizardDropDownAction = null;
- if (refreshNewsJobChangeListener != null) {
- RefreshNewsJob.INSTANCE.removeJobChangeListener(refreshNewsJobChangeListener);
- refreshNewsJobChangeListener = null;
+ if (refreshBlogsJobChangeListener != null) {
+ RefreshBlogsJob.INSTANCE.removeJobChangeListener(refreshBlogsJobChangeListener);
+ refreshBlogsJobChangeListener = null;
}
if (refreshTutorialsJobChangeListener != null) {
RefreshTutorialsJob.INSTANCE.removeJobChangeListener(refreshTutorialsJobChangeListener);
@@ -601,8 +594,8 @@
return true;
}
- private Image getNewsImage() {
- return JBossCentralActivator.getDefault().getImage("/icons/newsLink.gif");
+ private Image getFeedsImage() {
+ return JBossCentralActivator.getDefault().getImage("/icons/feedsLink.gif");
}
private void recomputeScrollComposite(ScrolledComposite composite, PageBook pageBook) {
@@ -640,20 +633,20 @@
pageBook.showPage(exceptionText);
}
- public void refreshNews() {
- RefreshNewsJob job = RefreshNewsJob.INSTANCE;
+ public void refreshBlogs() {
+ RefreshBlogsJob job = RefreshBlogsJob.INSTANCE;
if (job.getState() == Job.NONE) {
if (job.getException() != null) {
- showException(newsPageBook, newsExceptionText,
+ showException(blogsPageBook, blogsExceptionText,
job.getException());
return;
}
- List<NewsEntry> entries = job.getEntries();
+ List<FeedsEntry> entries = job.getEntries();
if (entries == null || entries.size() == 0) {
- showNote(newsPageBook, newsNoteText, scrollComposite);
+ showNote(blogsPageBook, blogsNoteText, scrollComposite);
return;
}
- showNews(entries);
+ showBlogs(entries);
}
}
@@ -793,19 +786,19 @@
}
}
- private void showNews(List<NewsEntry> entries) {
+ private void showBlogs(List<FeedsEntry> entries) {
int i = 0;
- disposeChildren(newsComposite);
+ disposeChildren(blogsComposite);
- for (final NewsEntry entry:entries) {
+ for (final FeedsEntry entry:entries) {
if (i++ > JBossCentralActivator.MAX_FEEDS) {
return;
}
String text = entry.getFormString();
- final FormText formText = toolkit.createFormText(newsComposite, true);
+ final FormText formText = toolkit.createFormText(blogsComposite, true);
TableWrapData td = new TableWrapData();
td.indent = 2;
- Point size = newsComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ Point size = blogsComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT);
td.maxWidth = size.x - 2;
try {
// to avoid illegal argumentexception on formtext fields.
@@ -827,9 +820,9 @@
//Font boldFont = getAuthorFont(display);
//formText.setFont("author", boldFont);
formText.setColor("author", JFaceColors.getHyperlinkText(getDisplay()));
- formText.setImage("image", getNewsImage());
+ formText.setImage("image", getFeedsImage());
if (entry.getDescription() != null && !entry.getDescription().isEmpty()) {
- ToolTip toolTip = new NewsToolTip(formText, entry.getDate() + " " + entry.getDescription());
+ ToolTip toolTip = new FeedsToolTip(formText, entry.getDate() + " " + entry.getDescription());
toolTip.activate();
}
formText.addHyperlinkListener(new HyperlinkAdapter() {
@@ -845,10 +838,10 @@
});
}
- newsPageBook.showPage(newsComposite);
+ blogsPageBook.showPage(blogsComposite);
form.reflow(true);
form.redraw();
- recomputeScrollComposite(scrollComposite, newsPageBook);
+ recomputeScrollComposite(scrollComposite, blogsPageBook);
}
protected void resize() {
@@ -856,12 +849,12 @@
GridData gd;
int widthHint = size.x/2 - 40;
- gd = (GridData) newsSection.getLayoutData();
+ gd = (GridData) blogsSection.getLayoutData();
gd.heightHint = size.y - 40;
gd.widthHint = widthHint;
gd.grabExcessVerticalSpace = false;
- Point computedSize = newsSection.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- newsSection.setSize(widthHint, computedSize.y);
+ Point computedSize = blogsSection.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ blogsSection.setSize(widthHint, computedSize.y);
gd = (GridData) tutorialsSection.getLayoutData();
//gridData.heightHint = size.y - 40;
@@ -895,11 +888,11 @@
y = 200;
}
tutorialScrollComposite.setMinSize(widthHint, y);
- refreshNews();
+ refreshBlogs();
form.layout(true, true);
}
- private class RefreshNewsJobChangeListener implements IJobChangeListener {
+ private class RefreshBlogsJobChangeListener implements IJobChangeListener {
@Override
public void aboutToRun(IJobChangeEvent event) {
@@ -917,7 +910,7 @@
@Override
public void run() {
- refreshNews();
+ refreshBlogs();
}
});
@@ -930,8 +923,8 @@
@Override
public void scheduled(IJobChangeEvent event) {
- RefreshNewsJob.INSTANCE.setException(null);
- showLoading(newsPageBook, newsLoadingComposite, scrollComposite);
+ RefreshBlogsJob.INSTANCE.setException(null);
+ showLoading(blogsPageBook, blogsLoadingComposite, scrollComposite);
}
@Override
Modified: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/JBossCentralEditor.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/JBossCentralEditor.java 2011-10-15 20:40:57 UTC (rev 35686)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/JBossCentralEditor.java 2011-10-15 21:25:01 UTC (rev 35687)
@@ -39,9 +39,9 @@
import org.eclipse.ui.forms.widgets.ScrolledForm;
import org.eclipse.ui.menus.CommandContributionItem;
import org.jboss.tools.central.JBossCentralActivator;
-import org.jboss.tools.central.actions.OpenJBossNewsHandler;
+import org.jboss.tools.central.actions.OpenJBossBlogsHandler;
import org.jboss.tools.central.editors.xpl.TextSearchControl;
-import org.jboss.tools.central.jobs.RefreshNewsJob;
+import org.jboss.tools.central.jobs.RefreshBlogsJob;
/**
*
@@ -83,7 +83,7 @@
softwareImage.dispose();
softwareImage = null;
}
- RefreshNewsJob.INSTANCE.cancel();
+ RefreshBlogsJob.INSTANCE.cancel();
super.dispose();
}
@@ -217,7 +217,7 @@
url.append(URLEncoder.encode(searchControl.getText(), UTF_8_ENCODING));
}
final String location = url.toString();
- AbstractHandler handler = new OpenJBossNewsHandler() {
+ AbstractHandler handler = new OpenJBossBlogsHandler() {
@Override
public String getLocation() {
Deleted: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/NewsToolTip.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/NewsToolTip.java 2011-10-15 20:40:57 UTC (rev 35686)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/NewsToolTip.java 2011-10-15 21:25:01 UTC (rev 35687)
@@ -1,212 +0,0 @@
-/*************************************************************************************
- * Copyright (c) 2008-2011 Red Hat, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * JBoss by Red Hat - Initial implementation.
- ************************************************************************************/
-
-package org.jboss.tools.central.editors;
-
-import org.eclipse.jface.window.ToolTip;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.browser.Browser;
-import org.eclipse.swt.browser.OpenWindowListener;
-import org.eclipse.swt.browser.WindowEvent;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseMoveListener;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.forms.widgets.FormText;
-
-/**
- *
- * @author snjeza
- *
- */
-public class NewsToolTip extends ToolTip {
-
- private String toolText;
- private static Shell CURRENT_TOOLTIP;
- private Label hintLabel;
- private FormText formText;
- private int x;
- private int y;
- private boolean focused = false;
-
-// private Listener deactivateListener = new Listener() {
-//
-// @Override
-// public void handleEvent(Event event) {
-// if (focused) {
-// if (CURRENT_TOOLTIP != null) {
-// CURRENT_TOOLTIP.dispose();
-// CURRENT_TOOLTIP = null;
-// }
-// activate();
-// hide();
-// focused = false;
-// }
-// }
-// };
-
- private MouseMoveListener mouseMoveListener = new MouseMoveListener() {
- public void mouseMove(MouseEvent e) {
- x = e.x;
- y = e.y;
- }
- };
- private Listener keyListener = new Listener() {
-
- @Override
- public void handleEvent(Event e) {
- if (e == null)
- return;
- if (e.keyCode == SWT.ESC) {
- if (CURRENT_TOOLTIP != null) {
- CURRENT_TOOLTIP.dispose();
- CURRENT_TOOLTIP = null;
- }
- activate();
- focused = false;
- }
- if (e.keyCode == SWT.F2) {
- if (CURRENT_TOOLTIP == null) {
- deactivate();
- hide();
- }
- focused = true;
- createFocusedTooltip(NewsToolTip.this.formText);
- }
- }
- };
-
- public NewsToolTip(FormText formText, String toolText) {
- super(formText);
- this.toolText = "<html>" +
- "<head>" +
- "<title>JBoss</title>" +
- "<style>" +
- "html, body { font-size: 12px;font-family: Arial, Helvetica, sans-serif; }" +
- "h1, h2, h3, h4, h5, h6 { font-size: 14px;font-weight:bold;font-family: Arial, Helvetica, sans-serif; }" +
- "</style>" +
- "</head>" +
- "<body>" +
- toolText +
- "</body>" +
- "</html>";
- this.formText = formText;
- setShift(new Point(0, 15));
- setPopupDelay(400);
- setHideOnMouseDown(true);
- }
-
- public void createFocusedTooltip(final Control control) {
- final Shell stickyTooltip = new Shell(control.getShell(), SWT.ON_TOP | SWT.TOOL
- | SWT.NO_FOCUS);
- stickyTooltip.setLayout(new GridLayout());
- //stickyTooltip.setBackground(stickyTooltip.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
-
- control.getDisplay().asyncExec(new Runnable() {
- public void run() {
- Event event = new Event();
- event.x = x;
- event.y = y;
- event.widget = control;
-
- createToolTipContentArea(event, stickyTooltip);
- stickyTooltip.pack();
-
- stickyTooltip.setLocation(stickyTooltip.getDisplay().getCursorLocation());
- hintLabel.setText("Press 'ESC' to Hide.");
- stickyTooltip.setVisible(true);
- }
- });
- CURRENT_TOOLTIP = stickyTooltip;
- }
-
- @Override
- protected Composite createToolTipContentArea(Event event, Composite parent) {
- if (!focused) {
- formText.setFocus();
- }
-// if (formText.getShell() != null) {
-// formText.getShell().addListener(SWT.Deactivate, deactivateListener);
-// }
- formText.addMouseMoveListener(mouseMoveListener);
- formText.addListener(SWT.KeyDown, keyListener);
-
- parent.addDisposeListener(new DisposeListener() {
-
- @Override
- public void widgetDisposed(DisposeEvent e) {
- if (formText != null && !formText.isDisposed()) {
- formText.removeMouseMoveListener(mouseMoveListener);
- formText.removeListener(SWT.KeyDown, keyListener);
-// if (formText.getShell() != null && !formText.getShell().isDisposed()) {
-// formText.getShell().removeListener(SWT.Deactivate, deactivateListener);
-// }
- }
- }
- });
-
-
- parent.setLayout(new GridLayout());
- GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
- parent.setLayoutData(gd);
-
- Browser browser = new Browser(parent, SWT.NONE);
- browser.setJavascriptEnabled(false);
- browser.addOpenWindowListener(new OpenWindowListener() {
- public void open(WindowEvent event) {
- event.required= true;
- }
- });
- gd = new GridData(SWT.FILL, SWT.FILL, true, true);
- gd.heightHint = 150;
- gd.widthHint = 400;
- browser.setLayoutData(gd);
- browser.setText(toolText);
-
- hintLabel = new Label(parent, SWT.NONE);
- gd = new GridData(SWT.FILL, SWT.FILL, true, true);
- hintLabel.setLayoutData(gd);
- hintLabel.setAlignment(SWT.RIGHT);
- hintLabel.setBackground(parent.getDisplay().getSystemColor(
- SWT.COLOR_INFO_BACKGROUND));
- hintLabel.setText("Press 'F2' for Focus.");
- hintLabel.setForeground(parent.getDisplay().getSystemColor(
- SWT.COLOR_DARK_GRAY));
-
- final Font font;
- Display display = parent.getDisplay();
- FontData[] fd = parent.getFont().getFontData();
- int size2 = fd.length;
- for (int i = 0; i < size2; i++)
- fd[i].setHeight(7);
- font = new Font(display, fd);
- parent.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- font.dispose();
- }
- });
- hintLabel.setFont(font);
- return parent;
- }
-
-}
Copied: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/jobs/RefreshBlogsJob.java (from rev 35631, trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/jobs/RefreshNewsJob.java)
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/jobs/RefreshBlogsJob.java (rev 0)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/jobs/RefreshBlogsJob.java 2011-10-15 21:25:01 UTC (rev 35687)
@@ -0,0 +1,144 @@
+package org.jboss.tools.central.jobs;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import org.apache.commons.lang.StringEscapeUtils;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.jboss.tools.central.JBossCentralActivator;
+import org.jboss.tools.central.model.FeedsEntry;
+
+import com.sun.syndication.feed.synd.SyndContent;
+import com.sun.syndication.feed.synd.SyndEntry;
+import com.sun.syndication.feed.synd.SyndFeed;
+import com.sun.syndication.io.SyndFeedInput;
+import com.sun.syndication.io.XmlReader;
+
+public class RefreshBlogsJob extends Job {
+
+ private List<FeedsEntry> entries = new ArrayList<FeedsEntry>();
+ private Exception exception;
+ public static RefreshBlogsJob INSTANCE = new RefreshBlogsJob(JBossCentralActivator.BLOGS_ATOM_URL);
+
+ private String blogsurl;
+
+ private RefreshBlogsJob(String blogsurl) {
+ super("Refreshing JBoss Blogs...");
+ setPriority(LONG);
+ this.blogsurl=blogsurl;
+ }
+
+ @Override
+ public IStatus run(IProgressMonitor monitor) {
+ if (monitor.isCanceled()) {
+ return Status.CANCEL_STATUS;
+ }
+ entries.clear();
+ SyndFeedInput input = new SyndFeedInput();
+ URL url;
+ try {
+ url = new URL(blogsurl);
+ } catch (MalformedURLException e) {
+ exception = e;
+ return Status.CANCEL_STATUS;
+ }
+ try {
+ SyndFeed syndFeed = input.build(new XmlReader(url));
+ List<SyndEntry> feeds = syndFeed.getEntries();
+ if (feeds == null || feeds.size() == 0) {
+ return Status.OK_STATUS;
+ }
+ int i = 0;
+
+ for (SyndEntry feed:feeds) {
+ FeedsEntry entry = adaptEntry(feed);
+ if (entry == null) {
+ continue;
+ }
+ if (i++ > JBossCentralActivator.MAX_FEEDS) {
+ break;
+ }
+ entries.add(entry);
+ }
+ } catch (Exception e) {
+ exception = e;
+ return Status.CANCEL_STATUS;
+ }
+ return Status.OK_STATUS;
+ }
+
+
+ private FeedsEntry adaptEntry(SyndEntry entry) {
+ if (entry == null) {
+ return null;
+ }
+ String title = null;
+ if (entry.getTitle() != null) {
+ title = entry.getTitle();
+ } else {
+ SyndContent titleEx = entry.getTitleEx();
+ if (titleEx != null && !titleEx.getValue().isEmpty()) {
+ title = titleEx.getValue();
+ }
+ }
+ if (title == null) {
+ return null;
+ }
+ title = StringEscapeUtils.escapeHtml(title);
+ String link;
+ if (entry.getLink() != null) {
+ link = entry.getLink();
+ } else {
+ link = entry.getUri();
+ }
+ String description = null;
+ if (entry.getDescription() != null) {
+ SyndContent desc = entry.getDescription();
+ if (desc != null && !desc.getValue().isEmpty()) {
+ description = desc.getValue();
+ }
+ }
+ if (description == null) {
+ List<SyndContent> contents = entry.getContents();
+ if (contents != null && contents.size() > 0) {
+ SyndContent desc = contents.get(0);
+ if (desc != null && !desc.getValue().isEmpty()) {
+ description = desc.getValue();
+ }
+ }
+ }
+
+
+ Date date;
+ if (entry.getUpdatedDate() != null) {
+ date = entry.getUpdatedDate();
+ } else {
+ date = entry.getPublishedDate();
+ }
+ String author = entry.getAuthor();
+ if (author != null) {
+ author = StringEscapeUtils.escapeHtml(author);
+ }
+
+ //description = " " + description;
+ return new FeedsEntry(title, link, description, entry.getAuthor(), date);
+ }
+
+ public Exception getException() {
+ return exception;
+ }
+
+ public void setException(Exception exception) {
+ this.exception = exception;
+ }
+
+ public List<FeedsEntry> getEntries() {
+ return entries;
+ }
+}
Deleted: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/jobs/RefreshNewsJob.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/jobs/RefreshNewsJob.java 2011-10-15 20:40:57 UTC (rev 35686)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/jobs/RefreshNewsJob.java 2011-10-15 21:25:01 UTC (rev 35687)
@@ -1,144 +0,0 @@
-package org.jboss.tools.central.jobs;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
-import org.apache.commons.lang.StringEscapeUtils;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.jboss.tools.central.JBossCentralActivator;
-import org.jboss.tools.central.model.NewsEntry;
-
-import com.sun.syndication.feed.synd.SyndContent;
-import com.sun.syndication.feed.synd.SyndEntry;
-import com.sun.syndication.feed.synd.SyndFeed;
-import com.sun.syndication.io.SyndFeedInput;
-import com.sun.syndication.io.XmlReader;
-
-public class RefreshNewsJob extends Job {
-
- private List<NewsEntry> entries = new ArrayList<NewsEntry>();
- private Exception exception;
- public static RefreshNewsJob INSTANCE = new RefreshNewsJob(JBossCentralActivator.NEWS_ATOM_URL);
-
- private String newsurl;
-
- private RefreshNewsJob(String newsurl) {
- super("Refreshing JBoss News...");
- setPriority(LONG);
- this.newsurl=newsurl;
- }
-
- @Override
- public IStatus run(IProgressMonitor monitor) {
- if (monitor.isCanceled()) {
- return Status.CANCEL_STATUS;
- }
- entries.clear();
- SyndFeedInput input = new SyndFeedInput();
- URL url;
- try {
- url = new URL(newsurl);
- } catch (MalformedURLException e) {
- exception = e;
- return Status.CANCEL_STATUS;
- }
- try {
- SyndFeed syndFeed = input.build(new XmlReader(url));
- List<SyndEntry> feeds = syndFeed.getEntries();
- if (feeds == null || feeds.size() == 0) {
- return Status.OK_STATUS;
- }
- int i = 0;
-
- for (SyndEntry feed:feeds) {
- NewsEntry entry = adaptEntry(feed);
- if (entry == null) {
- continue;
- }
- if (i++ > JBossCentralActivator.MAX_FEEDS) {
- break;
- }
- entries.add(entry);
- }
- } catch (Exception e) {
- exception = e;
- return Status.CANCEL_STATUS;
- }
- return Status.OK_STATUS;
- }
-
-
- private NewsEntry adaptEntry(SyndEntry entry) {
- if (entry == null) {
- return null;
- }
- String title = null;
- if (entry.getTitle() != null) {
- title = entry.getTitle();
- } else {
- SyndContent titleEx = entry.getTitleEx();
- if (titleEx != null && !titleEx.getValue().isEmpty()) {
- title = titleEx.getValue();
- }
- }
- if (title == null) {
- return null;
- }
- title = StringEscapeUtils.escapeHtml(title);
- String link;
- if (entry.getLink() != null) {
- link = entry.getLink();
- } else {
- link = entry.getUri();
- }
- String description = null;
- if (entry.getDescription() != null) {
- SyndContent desc = entry.getDescription();
- if (desc != null && !desc.getValue().isEmpty()) {
- description = desc.getValue();
- }
- }
- if (description == null) {
- List<SyndContent> contents = entry.getContents();
- if (contents != null && contents.size() > 0) {
- SyndContent desc = contents.get(0);
- if (desc != null && !desc.getValue().isEmpty()) {
- description = desc.getValue();
- }
- }
- }
-
-
- Date date;
- if (entry.getUpdatedDate() != null) {
- date = entry.getUpdatedDate();
- } else {
- date = entry.getPublishedDate();
- }
- String author = entry.getAuthor();
- if (author != null) {
- author = StringEscapeUtils.escapeHtml(author);
- }
-
- //description = " " + description;
- return new NewsEntry(title, link, description, entry.getAuthor(), date);
- }
-
- public Exception getException() {
- return exception;
- }
-
- public void setException(Exception exception) {
- this.exception = exception;
- }
-
- public List<NewsEntry> getEntries() {
- return entries;
- }
-}
Copied: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/model/FeedsEntry.java (from rev 35676, 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/FeedsEntry.java (rev 0)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/model/FeedsEntry.java 2011-10-15 21:25:01 UTC (rev 35687)
@@ -0,0 +1,173 @@
+package org.jboss.tools.central.model;
+
+import java.util.Date;
+
+import org.apache.commons.lang.StringEscapeUtils;
+import org.apache.commons.lang.StringUtils;
+import org.jboss.tools.central.JBossCentralActivator;
+
+import com.ocpsoft.pretty.time.PrettyTime;
+
+public class FeedsEntry {
+ private String title;
+ private String link;
+ private String description;
+ private String author;
+ private Date date;
+
+ public FeedsEntry() {
+ }
+
+ public FeedsEntry(String title, String link, String description,
+ String author, Date date) {
+ this.title = title;
+ this.link = link;
+ this.description = description;
+ 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;
+ }
+
+ public String getFormString() {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append(JBossCentralActivator.FORM_START_TAG);
+ buffer.append("<img href=\"image\"/> ");
+ if (link != null && !link.isEmpty()) {
+ buffer.append("<a href=\"");
+ buffer.append(link);
+ buffer.append("\">");
+ buffer.append(StringEscapeUtils.unescapeXml(title));
+ buffer.append("</a>");
+ } else {
+ buffer.append(title);
+ }
+ //buffer.append("<br/>");
+ boolean cr = false;
+ if (date != null) {
+ /*buffer.append("<span font=\"default\">");
+ buffer.append("posted ");
+ buffer.append("</span>");*/
+ buffer.append("<b>");
+ PrettyTime prettyTime = new PrettyTime(new Date());
+ buffer.append(" " + prettyTime.format(date));
+ buffer.append("</b>");
+ cr = true;
+ }
+ if (author != null && !author.isEmpty() && !"(author unknown)".equalsIgnoreCase(author)) {
+ buffer.append(" ");
+ buffer.append("<span font=\"default\">");
+ buffer.append(" by");
+ buffer.append("</span>");
+ buffer.append(" ");
+ buffer.append("<span color=\"author\" font=\"author\">");
+ buffer.append(author);
+ buffer.append("</span>");
+ cr = true;
+ }
+
+ if (cr) {
+ 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() {
+ return "FeedsEntry [title=" + title + ", link=" + link
+ + ", description=" + description + ", author=" + author
+ + ", date=" + date + "]";
+ }
+
+}
Deleted: 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-10-15 20:40:57 UTC (rev 35686)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/model/NewsEntry.java 2011-10-15 21:25:01 UTC (rev 35687)
@@ -1,173 +0,0 @@
-package org.jboss.tools.central.model;
-
-import java.util.Date;
-
-import org.apache.commons.lang.StringEscapeUtils;
-import org.apache.commons.lang.StringUtils;
-import org.jboss.tools.central.JBossCentralActivator;
-
-import com.ocpsoft.pretty.time.PrettyTime;
-
-public class NewsEntry {
- private String title;
- private String link;
- private String description;
- private String author;
- private Date date;
-
- public NewsEntry() {
- }
-
- public NewsEntry(String title, String link, String description,
- String author, Date date) {
- this.title = title;
- this.link = link;
- this.description = description;
- 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;
- }
-
- public String getFormString() {
- StringBuffer buffer = new StringBuffer();
- buffer.append(JBossCentralActivator.FORM_START_TAG);
- buffer.append("<img href=\"image\"/> ");
- if (link != null && !link.isEmpty()) {
- buffer.append("<a href=\"");
- buffer.append(link);
- buffer.append("\">");
- buffer.append(StringEscapeUtils.unescapeXml(title));
- buffer.append("</a>");
- } else {
- buffer.append(title);
- }
- //buffer.append("<br/>");
- boolean cr = false;
- if (date != null) {
- /*buffer.append("<span font=\"default\">");
- buffer.append("posted ");
- buffer.append("</span>");*/
- buffer.append("<b>");
- PrettyTime prettyTime = new PrettyTime(new Date());
- buffer.append(" " + prettyTime.format(date));
- buffer.append("</b>");
- cr = true;
- }
- if (author != null && !author.isEmpty() && !"(author unknown)".equalsIgnoreCase(author)) {
- buffer.append(" ");
- buffer.append("<span font=\"default\">");
- buffer.append(" by");
- buffer.append("</span>");
- buffer.append(" ");
- buffer.append("<span color=\"author\" font=\"author\">");
- buffer.append(author);
- buffer.append("</span>");
- cr = true;
- }
-
- if (cr) {
- 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() {
- return "NewsEntry [title=" + title + ", link=" + link
- + ", description=" + description + ", author=" + author
- + ", date=" + date + "]";
- }
-
-}
13 years, 3 months
JBoss Tools SVN: r35686 - in trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central: dialogs and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2011-10-15 16:40:57 -0400 (Sat, 15 Oct 2011)
New Revision: 35686
Modified:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/JBossCentralActivator.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/ShowJBossCentral.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/dialogs/ProjectExamplesDialog.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/SoftwarePage.java
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/JBossCentralActivator.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/JBossCentralActivator.java 2011-10-15 18:51:43 UTC (rev 35685)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/JBossCentralActivator.java 2011-10-15 20:40:57 UTC (rev 35686)
@@ -62,6 +62,8 @@
*/
public class JBossCentralActivator extends AbstractUIPlugin {
+ private static final String JBOSS_DISCOVERY_DIRECTORY = "jboss.discovery.directory";
+
public static final String JBOSS_DISCOVERY_DIRECTORY_3_3_0_XML = "http://download.jboss.org/jbosstools/examples/directory-3.3.0.xml";
public static final String ICON = "icon";
@@ -428,4 +430,11 @@
return bundleContext;
}
+ public static String getJBossDiscoveryDirectory() {
+ String directory = System.getProperty(JBOSS_DISCOVERY_DIRECTORY, null);
+ if (directory == null) {
+ return JBOSS_DISCOVERY_DIRECTORY_3_3_0_XML;
+ }
+ return directory;
+ }
}
Modified: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/ShowJBossCentral.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/ShowJBossCentral.java 2011-10-15 18:51:43 UTC (rev 35685)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/ShowJBossCentral.java 2011-10-15 20:40:57 UTC (rev 35686)
@@ -10,12 +10,12 @@
************************************************************************************/
package org.jboss.tools.central;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
-import org.eclipse.equinox.p2.core.IProvisioningAgent;
-import org.eclipse.equinox.p2.engine.IProfile;
-import org.eclipse.equinox.p2.engine.IProfileRegistry;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IStartup;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.Version;
/**
*
@@ -24,50 +24,52 @@
*/
public class ShowJBossCentral implements IStartup {
+ private static final String ORG_JBOSS_TOOLS_USAGE = "org.jboss.tools.usage";
+
@Override
public void earlyStartup() {
- boolean showJBossCentral = JBossCentralActivator.getDefault().showJBossCentralOnStartup();
- IProvisioningAgent agent = (IProvisioningAgent) JBossCentralActivator.getDefault().getService(IProvisioningAgent.SERVICE_NAME);
- IProfileRegistry profileRegistry = (IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME);
- if (profileRegistry == null) {
- showJBossCentral = true;
- } else {
- IProfile profile = profileRegistry
- .getProfile(IProfileRegistry.SELF);
-
- if (profile != null) { // got NPE's when running in PDE
- String profileId = profile.getProfileId();
+ boolean showJBossCentral = JBossCentralActivator.getDefault()
+ .showJBossCentralOnStartup();
+ if (!showJBossCentral) {
+ Bundle usage = Platform.getBundle(ORG_JBOSS_TOOLS_USAGE);
+ if (usage != null) {
+ Version version = usage.getVersion();
+ String versionString = version.toString();
IEclipsePreferences prefs = JBossCentralActivator.getDefault()
.getPreferences();
- String savedId = prefs.get(JBossCentralActivator.PROFILE_ID,
- null);
- if (savedId == null || !savedId.equals(profileId)) {
- prefs.put(JBossCentralActivator.PROFILE_ID, profileId);
+ String savedVersion = prefs.get(ORG_JBOSS_TOOLS_USAGE, "");
+ Bundle central = Platform
+ .getBundle(JBossCentralActivator.PLUGIN_ID);
+ if (!savedVersion.equals(versionString)) {
showJBossCentral = true;
+ prefs.put(ORG_JBOSS_TOOLS_USAGE, versionString);
+ if (central != null) {
+ prefs.put(JBossCentralActivator.PLUGIN_ID, central.getVersion().toString());
+ }
+ } else {
+ if (central != null) {
+ version = central.getVersion();
+ versionString = version.toString();
+ savedVersion = prefs.get(
+ JBossCentralActivator.PLUGIN_ID, "");
+ if (!savedVersion.equals(versionString)) {
+ showJBossCentral = true;
+ prefs.put(JBossCentralActivator.PLUGIN_ID, versionString);
+ }
+ }
}
- long timestamp = profile.getTimestamp();
- long savedTimestamp = prefs.getLong(
- JBossCentralActivator.PROFILE_TIMESTAMP, -1);
- if (timestamp != savedTimestamp) {
- prefs.putLong(JBossCentralActivator.PROFILE_TIMESTAMP,
- timestamp);
- showJBossCentral = true;
- }
- } else {
- // TODO: Not sure what is supposed to happen here if profile doesn't exist ?
}
}
if (!showJBossCentral) {
return;
}
Display.getDefault().asyncExec(new Runnable() {
-
+
@Override
public void run() {
JBossCentralActivator.getJBossCentralEditor();
}
});
-
}
}
Modified: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/dialogs/ProjectExamplesDialog.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/dialogs/ProjectExamplesDialog.java 2011-10-15 18:51:43 UTC (rev 35685)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/dialogs/ProjectExamplesDialog.java 2011-10-15 20:40:57 UTC (rev 35686)
@@ -196,6 +196,8 @@
private void addDescription(ProjectFix projectFix) {
FormText fixDescriptionText = toolkit.createFormText(fixesComposite, true);
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, true, false);
+ fixDescriptionText.setLayoutData(gd);
StringBuffer buffer = new StringBuffer();
buffer.append(JBossCentralActivator.FORM_START_TAG);
buffer.append("<img href=\"image\"/> ");
@@ -215,6 +217,8 @@
protected void addRuntimeFixActions(ProjectFix projectFix) {
Button install = toolkit.createButton(fixesComposite, "Install", SWT.PUSH);
+ GridData gd = new GridData(SWT.FILL, SWT.END, false, false);
+ install.setLayoutData(gd);
ToolTip tooltip = new DescriptionToolTip(install, "JBoss Runtime Detection");
tooltip.activate();
//install.setImage(JBossCentralActivator.getDefault().getImage("/icons/search_local.png"));
@@ -237,6 +241,8 @@
if (downloadRuntime != null) {
haveDownloadId = true;
Button download = toolkit.createButton(fixesComposite, "Download and Install...", SWT.PUSH);
+ gd = new GridData(SWT.FILL, SWT.END, false, false);
+ download.setLayoutData(gd);
ToolTip tip = new DescriptionToolTip(download, "Download and install " + downloadRuntime.getName());
tip.activate();
//download.setImage(JBossCentralActivator.getDefault().getImage("/icons/repository-submit.gif"));
@@ -312,7 +318,7 @@
connectorDiscovery.getDiscoveryStrategies().add(new BundleDiscoveryStrategy());
RemoteBundleDiscoveryStrategy remoteDiscoveryStrategy = new RemoteBundleDiscoveryStrategy();
- remoteDiscoveryStrategy.setDirectoryUrl(JBossCentralActivator.JBOSS_DISCOVERY_DIRECTORY_3_3_0_XML);
+ remoteDiscoveryStrategy.setDirectoryUrl(JBossCentralActivator.getJBossDiscoveryDirectory());
connectorDiscovery.getDiscoveryStrategies().add(remoteDiscoveryStrategy);
connectorDiscovery.setEnvironment(JBossCentralActivator.getEnvironment());
Modified: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/SoftwarePage.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/SoftwarePage.java 2011-10-15 18:51:43 UTC (rev 35685)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/SoftwarePage.java 2011-10-15 20:40:57 UTC (rev 35686)
@@ -123,7 +123,7 @@
discoveryViewer = new DiscoveryViewer(getSite(), this);
discoveryViewer.setShowConnectorDescriptorKindFilter(false);
discoveryViewer.setShowInstalledFilterEnabled(true);
- discoveryViewer.setDirectoryUrl(JBossCentralActivator.JBOSS_DISCOVERY_DIRECTORY_3_3_0_XML);
+ discoveryViewer.setDirectoryUrl(JBossCentralActivator.getJBossDiscoveryDirectory());
discoveryViewer.createControl(pageBook);
discoveryViewer.setEnvironment(getEnvironment());
discoveryViewer.addFilter(new ViewerFilter() {
13 years, 3 months
JBoss Tools SVN: r35685 - in trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central: editors and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2011-10-15 14:51:43 -0400 (Sat, 15 Oct 2011)
New Revision: 35685
Modified:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/JBossCentralActivator.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/JBossCentralEditor.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/xpl/TextSearchControl.java
Log:
JBIDE-9839 Search field in central has weird/incorrect options
Modified: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/JBossCentralActivator.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/JBossCentralActivator.java 2011-10-15 18:46:31 UTC (rev 35684)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/JBossCentralActivator.java 2011-10-15 18:51:43 UTC (rev 35685)
@@ -62,7 +62,7 @@
*/
public class JBossCentralActivator extends AbstractUIPlugin {
- public static final String JBOSS_DISCOVERY_DIRECTORY_3_3_0_XML = "http://download.jboss.org/jbosstools/updates/nightly/trunk/directory.xml";
+ public static final String JBOSS_DISCOVERY_DIRECTORY_3_3_0_XML = "http://download.jboss.org/jbosstools/examples/directory-3.3.0.xml";
public static final String ICON = "icon";
@@ -112,11 +112,11 @@
public static final String TUTORIALS_EXTENSION_ID = "org.jboss.tools.central.tutorials";
- public static final String SEARCH_PROJECT_PAGES = "Search Project Pages";
+ //public static final String SEARCH_PROJECT_PAGES = "Search Project Pages";
- public static final String SEARCH_THE_COMMUNITY = "Search the Community";
+ public static final String SEARCH_THE_COMMUNITY = "Search JBoss Community";
- public static final String SEARCH_COMMUNITY_PORTAL = "Search Community Portal";
+ public static final String SEARCH_RED_HAT_CUSTOMER_PORTAL = "Search Red Hat Customer Portal ";
public Map<String, TutorialCategory> tutorialCategories;
Modified: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/JBossCentralEditor.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/JBossCentralEditor.java 2011-10-15 18:46:31 UTC (rev 35684)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/JBossCentralEditor.java 2011-10-15 18:51:43 UTC (rev 35685)
@@ -207,7 +207,7 @@
try {
StringBuffer url = new StringBuffer();
String initialMessage = searchControl.getInitialMessage();
- if (JBossCentralActivator.SEARCH_COMMUNITY_PORTAL.equals(initialMessage)) {
+ if (JBossCentralActivator.SEARCH_RED_HAT_CUSTOMER_PORTAL.equals(initialMessage)) {
url.append("https://access.redhat.com/knowledge/searchResults?col=avalon_portal&topSe...");
url.append(URLEncoder.encode(searchControl.getText(), UTF_8_ENCODING));
} else {
@@ -237,18 +237,14 @@
});
final Menu menu = new Menu(menuLink);
+ final MenuItem searchCommunityPortal = new MenuItem(menu, SWT.CHECK);
+ searchCommunityPortal.setText(JBossCentralActivator.SEARCH_RED_HAT_CUSTOMER_PORTAL);
final MenuItem searchCommunity = new MenuItem(menu, SWT.CHECK);
searchCommunity.setText(JBossCentralActivator.SEARCH_THE_COMMUNITY);
- final MenuItem searchProjectPages = new MenuItem(menu, SWT.CHECK);
- searchProjectPages.setText(JBossCentralActivator.SEARCH_PROJECT_PAGES);
- final MenuItem searchCommunityPortal = new MenuItem(menu, SWT.CHECK);
- searchCommunityPortal.setText(JBossCentralActivator.SEARCH_COMMUNITY_PORTAL);
String initialMessage = searchControl.getInitialMessage();
- if (JBossCentralActivator.SEARCH_COMMUNITY_PORTAL.equals(initialMessage)) {
+ if (JBossCentralActivator.SEARCH_RED_HAT_CUSTOMER_PORTAL.equals(initialMessage)) {
searchCommunityPortal.setSelection(true);
- } else if (JBossCentralActivator.SEARCH_PROJECT_PAGES.equals(initialMessage)) {
- searchProjectPages.setSelection(true);
} else {
searchCommunity.setSelection(true);
}
@@ -257,32 +253,19 @@
@Override
public void widgetSelected(SelectionEvent e) {
searchCommunity.setSelection(true);
- searchProjectPages.setSelection(false);
searchCommunityPortal.setSelection(false);
searchControl.setInitialMessage(JBossCentralActivator.SEARCH_THE_COMMUNITY);
}
});
- searchProjectPages.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- searchProjectPages.setSelection(true);
- searchCommunity.setSelection(false);
- searchCommunityPortal.setSelection(false);
- searchControl.setInitialMessage(JBossCentralActivator.SEARCH_PROJECT_PAGES);
- }
- });
-
searchCommunityPortal.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- searchProjectPages.setSelection(false);
searchCommunity.setSelection(false);
searchCommunityPortal.setSelection(true);
- searchControl.setInitialMessage(JBossCentralActivator.SEARCH_COMMUNITY_PORTAL);
+ searchControl.setInitialMessage(JBossCentralActivator.SEARCH_RED_HAT_CUSTOMER_PORTAL);
}
});
Modified: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/xpl/TextSearchControl.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/xpl/TextSearchControl.java 2011-10-15 18:46:31 UTC (rev 35684)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/xpl/TextSearchControl.java 2011-10-15 18:51:43 UTC (rev 35685)
@@ -225,7 +225,7 @@
}
String message = section.get(INITIAL_MESSAGE);
if (message == null || message.isEmpty()) {
- message = JBossCentralActivator.SEARCH_THE_COMMUNITY;
+ message = JBossCentralActivator.SEARCH_RED_HAT_CUSTOMER_PORTAL;
}
setInitialMessage(message);
13 years, 3 months
JBoss Tools SVN: r35684 - trunk/central/plugins/org.jboss.tools.central.discovery.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2011-10-15 14:46:31 -0400 (Sat, 15 Oct 2011)
New Revision: 35684
Modified:
trunk/central/plugins/org.jboss.tools.central.discovery/build.properties
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.discovery/build.properties
===================================================================
--- trunk/central/plugins/org.jboss.tools.central.discovery/build.properties 2011-10-15 18:40:41 UTC (rev 35683)
+++ trunk/central/plugins/org.jboss.tools.central.discovery/build.properties 2011-10-15 18:46:31 UTC (rev 35684)
@@ -3,7 +3,3 @@
plugin.xml,\
plugin.properties,\
images/
-output.. = bin/
-source.. = src/
-src.includes = *
-src.excludes = src
13 years, 3 months
JBoss Tools SVN: r35683 - trunk/central/plugins/org.jboss.tools.central.discovery/META-INF.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2011-10-15 14:40:41 -0400 (Sat, 15 Oct 2011)
New Revision: 35683
Modified:
trunk/central/plugins/org.jboss.tools.central.discovery/META-INF/MANIFEST.MF
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.discovery/META-INF/MANIFEST.MF
===================================================================
--- trunk/central/plugins/org.jboss.tools.central.discovery/META-INF/MANIFEST.MF 2011-10-15 00:43:08 UTC (rev 35682)
+++ trunk/central/plugins/org.jboss.tools.central.discovery/META-INF/MANIFEST.MF 2011-10-15 18:40:41 UTC (rev 35683)
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %BundleVendor
Bundle-SymbolicName: org.jboss.tools.central.discovery;singleton:=true
-Bundle-Version: 1.0.0.qualifier
+Bundle-Version: 3.3.0
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.mylyn.discovery.core;bundle-version="3.6.0"
Bundle-ActivationPolicy: lazy
13 years, 3 months