import java.io.PushbackInputStream;
import java.net.URL;
import java.net.URLConnection;
-import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.HashSet;
/**
* @author jnegre - http://www.jnegre.org/
*
- * (c)Copyright 2002 Jérôme Nègre
+ * (c)Copyright 2002 J�r�me N�gre
*
*/
public class Channel {
}
this.readUids = null;
- } catch(UnknownHostException e) {
- // no connection to internet
} catch(Exception e) {
newErrorMessage = e.toString();
Plugin.logInfo("Error in channel update",e);
/*******************************************************************************
- * Copyright (c) 2004 Jérôme Nègre.
+ * Copyright (c) 2004 J�r�me N�gre.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.jnegre.org/cpl1_0.html
*
* Contributors:
- * Jérôme Nègre - initial API and implementation
+ * J�r�me N�gre - initial API and implementation
*******************************************************************************/
/*
import org.eclipse.swt.graphics.Image;
/**
- * @author Jérôme Nègre
+ * @author J�r�me N�gre
*/
public class IconManager {
//the root folder containing the icons
/**
* @author jnegre - http://www.jnegre.org/
*
- * (c)Copyright 2002 Jérôme Nègre
+ * (c)Copyright 2002 J�r�me N�gre
*
*/
public class Item {
this.channel = channel;
this.title = readValue("title", itemElement, 0);
this.link = readValue("link", itemElement, 0);
- this.description = readValue("description", itemElement, 0);
+
+ String simpleDescription = readValue("description", itemElement, 0);
+ String contentEncoded = readValue("content:encoded", itemElement, 0);
+ this.description = contentEncoded!=null?contentEncoded:simpleDescription;
+
this.author = readValue("author", itemElement, 0);
this.guid = readValue("guid", itemElement, 1);
String pubDate = readValue("pubDate", itemElement, 0);
if(string.charAt(position) == 'Z') {
calendar.set(Calendar.ZONE_OFFSET,0);
if(length != position +1) {
- //trop de caractères
+ //trop de caract�res
throw new Exception("Invalid format of dc:date (extra tokens)");
}
} else if(string.charAt(position) == '+' || string.charAt(position) == '-') {
int minute = readInt(string,position+4,2);
calendar.set(Calendar.ZONE_OFFSET,sign*(hour*60*60*1000+minute*60*1000));
if(length != position +6) {
- //trop de caractères
+ //trop de caract�res
throw new Exception("Invalid format of dc:date (extra tokens)");
}
} else {
/*******************************************************************************
- * Copyright (c) 2004 Jérôme Nègre.
+ * Copyright (c) 2004 J�r�me N�gre.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.jnegre.org/cpl1_0.html
*
* Contributors:
- * Jérôme Nègre - initial API and implementation
+ * J�r�me N�gre - initial API and implementation
*******************************************************************************/
/*
import java.util.ResourceBundle;
/**
- * @author Jérôme Nègre
+ * @author J�r�me N�gre
*/
public class Messages {
- private static final String BUNDLE_NAME = "net.sourceforge.phpeclipse.news.messages";//$NON-NLS-1$
+ private static final String BUNDLE_NAME = "org.jnegre.allthenews.messages";//$NON-NLS-1$
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
.getBundle(BUNDLE_NAME);
/*
* Created on 15 mai 2004
- * Copyright 2004 Jérôme Nègre
+ * Copyright 2004 J�r�me N�gre
*/
package net.sourceforge.phpeclipse.news;
import java.util.ArrayList;
/**
- * @author Jérôme Nègre
+ * @author J�r�me N�gre
*/
public interface RssListener {
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2004 J�r�me N�gre.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.jnegre.org/cpl1_0.html
+ *
+ * Contributors:
+ * J�r�me N�gre - initial API and implementation
+ *******************************************************************************/
+
+/*
+ * Created on 19 d�c. 2004
+ */
+package net.sourceforge.phpeclipse.news.dialogs;
+
+import java.util.ArrayList;
+
+import net.sourceforge.phpeclipse.news.Channel;
+import net.sourceforge.phpeclipse.news.Plugin;
+import net.sourceforge.phpeclipse.news.pref.ChannelStore;
+
+import org.eclipse.jface.dialogs.Dialog;
+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.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * @author J�r�me N�gre
+ */
+public class NewChannelDialog extends Dialog {
+
+ private Text titleText;
+ private Text urlText;
+
+ /**
+ * @param parentShell
+ */
+ public NewChannelDialog(Shell parentShell) {
+ super(parentShell);
+ setShellStyle(SWT.DIALOG_TRIM|SWT.RESIZE);
+ }
+
+ protected Control createDialogArea(Composite parent) {
+ Composite composite = (Composite)super.createDialogArea(parent);
+ GridLayout layout = new GridLayout(2,false);
+ composite.setLayout(layout);
+ //composite.setBackground(composite.getDisplay().getSystemColor(SWT.COLOR_CYAN));
+
+ Label label = new Label(composite, SWT.NONE);
+ label.setText("Title: ");
+ titleText = new Text(composite, SWT.BORDER);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ titleText.setLayoutData(gd);
+
+ label = new Label(composite, SWT.NONE);
+ label.setText("Url: ");
+ urlText = new Text(composite, SWT.BORDER);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ urlText.setLayoutData(gd);
+
+ return composite;
+ }
+
+ protected void configureShell(Shell newShell) {
+ super.configureShell(newShell);
+ newShell.setText("Add New Channel");
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+ */
+ protected void okPressed() {
+ Channel channel = new Channel(titleText.getText(), urlText.getText());
+ ArrayList channels = Plugin.getDefault().getChannelList();
+ ChannelStore.saveReadStatus(channels);
+ channels.add(channel);
+ ChannelStore.setChannels(channels);
+ Plugin.getDefault().updateChannelList();
+ Plugin.getDefault().update();
+ this.close();
+ }
+
+}
/*
* Created on 9 juin 2004
- * Copyright 2004 Jérôme Nègre
+ * Copyright 2004 J�r�me N�gre
*/
package net.sourceforge.phpeclipse.news.pref;
import org.eclipse.jface.dialogs.IDialogSettings;
/**
- * @author Jérôme Nègre
+ * @author J�r�me N�gre
*/
public class ChannelStore {
/*
* Created on 14 juil. 2003
- * (c)2003 Jérôme Nègre - http://www.jnegre.org/
+ * (c)2003 J�r�me N�gre - http://www.jnegre.org/
*
*/
package net.sourceforge.phpeclipse.news.pref;
*
* Contributors:
* IBM Corporation - initial API and implementation
- * Jérôme Nègre - adaptation of ListEditor to add the search button
+ * J�r�me N�gre - adaptation of ListEditor to add the search button
*******************************************************************************/
package net.sourceforge.phpeclipse.news.pref;
/*
* Created on 15 mai 2004
- * Copyright 2004 Jérôme Nègre
+ * Copyright 2004 J�r�me N�gre
*/
package net.sourceforge.phpeclipse.news.view;
import net.sourceforge.phpeclipse.news.Item;
import net.sourceforge.phpeclipse.news.Plugin;
import net.sourceforge.phpeclipse.news.RssListener;
+import net.sourceforge.phpeclipse.news.dialogs.NewChannelDialog;
import net.sourceforge.phpeclipse.webbrowser.views.BrowserView;
import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.ui.part.ViewPart;
/**
- * @author Jérôme Nègre
+ * @author J�r�me N�gre
*/
public class ExplorerView extends ViewPart implements RssListener {
private Action refreshAction;
+ private Action newChannelAction;
+
public ExplorerView() {
super();
}
}
};
refreshAction.setToolTipText("Refresh");
+
+ // newChannel
+ newChannelAction = new Action("Add New Channel") {
+ public void run() {
+ NewChannelDialog ncd = new NewChannelDialog(ExplorerView.this.getViewSite().getShell());
+ ncd.open();
+ }
+ };
}
private void createMenu() {
- //IMenuManager mgr = getViewSite().getActionBars().getMenuManager();
- //mgr.add(clearAction);
+ IMenuManager mgr = getViewSite().getActionBars().getMenuManager();
+ mgr.add(newChannelAction);
}
private void createToolBar() {
// }
public void onItemSelected(Item item) {
if (item != null) { // && uiReady && linkAction.isChecked()) {
- // if(showDescritionAction.isChecked()) {
- // String desc = item.getDescription();
- // if(desc == null)
- // desc = HTML_NO_DESCRIPTION;
- // browser.setText(MessageFormat.format(HTML,new String[]{desc, encodeNewLine(desc), item.getUsableLink(),
- // item.getUsableTitle()}));
- // } else {
+ // if(showDescritionAction.isChecked()) {
+ // String desc = item.getDescription();
+ // if(desc == null)
+ // desc = HTML_NO_DESCRIPTION;
+ // browser.setText(MessageFormat.format(HTML,new String[]{desc, encodeNewLine(desc), item.getUsableLink(),
+ // item.getUsableTitle()}));
+ // } else {
setUrl(item.getUsableLink());
// }
//XXX this is a hack, should be done otherwise
/*
* Created on 15 mai 2004
- * Copyright 2004 Jérôme Nègre
+ * Copyright 2004 J�r�me N�gre
*/
package net.sourceforge.phpeclipse.news.view;
import org.eclipse.ui.part.ViewPart;
/**
- * @author Jérôme Nègre
+ * @author J�r�me N�gre
*/
public class HeadlineView extends ViewPart implements RssListener {
/*
* Created on 16 mai 2004
- * Copyright 2004 Jérôme Nègre
+ * Copyright 2004 J�r�me N�gre
*/
package net.sourceforge.phpeclipse.news.view;
import org.eclipse.swt.graphics.Image;
/**
- * @author Jérôme Nègre
+ * @author J�r�me N�gre
*/
public class NewsTreeViewerProvider
implements