<library name="lib/radeox.jar"/>
<library name="lib/commons-logging.jar"/>
<library name="lib/commons-httpclient-2.0.2.jar"/>
- <library name="lib/java2html_4.1.jar"/>
<library name="lib/plog4u.jar"/>
<library name="lib/velocity-dep-1.4.jar"/>
<library name="lib/mysql-connector.jar"/>
--- /dev/null
+package net.sourceforge.phpeclipse.wiki.editor;
+
+import net.sourceforge.phpeclipse.webbrowser.views.BrowserView;
+import net.sourceforge.phpeclipse.wiki.builder.CreatePageAction;
+import net.sourceforge.phpeclipse.wiki.preferences.Util;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.texteditor.ITextEditor;
+
+/**
+ * Set browser preview URL and refresh URL Utilities
+ */
+public class BrowserUtil {
+
+ public static void setBrowserPreview(ITextEditor editor) {
+ IWorkbenchPage page = WikiEditorPlugin.getDefault().getActivePage();
+ try {
+ IViewPart part = page.findView(BrowserView.ID_BROWSER);
+ if (part == null) {
+ part = page.showView(BrowserView.ID_BROWSER);
+ } else {
+ // if (bringToTopPreview) {
+ // page.bringToTop(part);
+ // }
+ }
+ IEditorInput editorInput = null;
+ if (editor != null) {
+ editorInput = editor.getEditorInput();
+ }
+ if (editorInput instanceof IFileEditorInput) {
+ IFile file = ((IFileEditorInput) editorInput).getFile();
+ String srcBasePath = Util.getWikiTextsPath(file);
+ String binBasePath = Util.getProjectsWikiOutputPath(file.getProject(), WikiEditorPlugin.HTML_OUTPUT_PATH);
+ String htmlName = Util.getHTMLFileName(file, binBasePath, srcBasePath);
+
+ if (htmlName != null) {
+ java.io.File htmlFile = new java.io.File(htmlName);
+ if (htmlFile.exists()) {
+ ((BrowserView) part).setUrl(htmlName);
+ }
+ }
+ }
+ } catch (Exception e) {
+ }
+ }
+
+ /**
+ *
+ */
+ public static void refreshBrowserPreview(WikiEditor editor) {
+
+ IWorkbenchPage page = WikiEditorPlugin.getDefault().getActivePage();
+ try {
+ IViewPart part = page.findView(BrowserView.ID_BROWSER);
+ if (part == null) {
+ part = page.showView(BrowserView.ID_BROWSER);
+ } else {
+ IEditorInput editorInput = null;
+ editorInput = editor.getEditorInput();
+ if (editorInput instanceof IFileEditorInput) {
+ IFile file = ((IFileEditorInput) editorInput).getFile();
+ CreatePageAction.createPage(file);
+
+ String srcBasePath = Util.getWikiTextsPath(file);
+ String binBasePath = Util.getProjectsWikiOutputPath(file.getProject(), WikiEditorPlugin.HTML_OUTPUT_PATH);
+ String htmlName = Util.getHTMLFileName(file, binBasePath, srcBasePath);
+ if (htmlName != null) {
+ java.io.File htmlFile = new java.io.File(htmlName);
+ if (htmlFile.exists()) {
+ ((BrowserView) part).refresh(htmlName);
+ }
+ }
+ }
+ }
+
+ } catch (Exception e) {
+ }
+ }
+
+}
\ No newline at end of file
**********************************************************************************************************************************/
package net.sourceforge.phpeclipse.wiki.editor;
-import net.sourceforge.phpeclipse.webbrowser.views.BrowserView;
-import net.sourceforge.phpeclipse.wiki.builder.CreatePageAction;
import net.sourceforge.phpeclipse.wiki.editor.model.WikipediaSection;
import net.sourceforge.phpeclipse.wiki.editor.model.WikipediaText;
import net.sourceforge.phpeclipse.wiki.preferences.Util;
import org.eclipse.jface.text.source.projection.ProjectionSupport;
import org.eclipse.jface.text.source.projection.ProjectionViewer;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.texteditor.AbstractDecoratedTextEditor;
import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
import org.eclipse.ui.texteditor.TextOperationAction;
*/
protected void editorSaved() {
super.editorSaved();
- // doesn't work here, wikibuilder has to be finished with generating html page
- IWorkbenchPage page = WikiEditorPlugin.getDefault().getActivePage();
- try {
- IViewPart part = page.findView(BrowserView.ID_BROWSER);
- if (part == null) {
- part = page.showView(BrowserView.ID_BROWSER);
- } else {
- // if (bringToTopPreview) {
- // page.bringToTop(part);
- // }
- }
- IEditorInput editorInput = null;
- editorInput = this.getEditorInput();
- if (editorInput instanceof IFileEditorInput) {
- CreatePageAction.createPage(((IFileEditorInput) editorInput).getFile());
- ((BrowserView) part).refresh();
- }
- } catch (Exception e) {
- }
+ BrowserUtil.refreshBrowserPreview(this);
}
package net.sourceforge.phpeclipse.wiki.editor;
-import net.sourceforge.phpeclipse.webbrowser.views.BrowserView;
-import net.sourceforge.phpeclipse.wiki.preferences.Util;
-import org.eclipse.core.resources.IFile;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.texteditor.BasicTextEditorActionContributor;
import org.eclipse.ui.texteditor.ITextEditor;
super.setActiveEditor(part);
ITextEditor editor = (part instanceof ITextEditor) ? (ITextEditor) part : null;
fContentAssist.setAction(getAction(editor, CONTENTASSIST_ACTION));
- // jsurfer
- setBrowserPreview(editor);
- }
-
- public void setBrowserPreview(ITextEditor editor) {
- IWorkbenchPage page = WikiEditorPlugin.getDefault().getActivePage();
- try {
- IViewPart part = page.findView(BrowserView.ID_BROWSER);
- if (part == null) {
- part = page.showView(BrowserView.ID_BROWSER);
- } else {
- // if (bringToTopPreview) {
- // page.bringToTop(part);
- // }
- }
- IEditorInput editorInput = null;
- if (editor != null) {
- editorInput = editor.getEditorInput();
- }
- if (editorInput instanceof IFileEditorInput) {
- IFile file = ((IFileEditorInput) editorInput).getFile();
- String srcBasePath = Util.getWikiTextsPath(file);
- String binBasePath = Util.getProjectsWikiOutputPath(file.getProject(), WikiEditorPlugin.HTML_OUTPUT_PATH);
- String htmlName = Util.getHTMLFileName(file, binBasePath, srcBasePath);
- if (htmlName!=null) {
- ((BrowserView) part).setUrl(htmlName);
- }
- }
- } catch (Exception e) {
- }
+
+ BrowserUtil.setBrowserPreview(editor);
}
public void contributeToMenu(IMenuManager menu) {
import java.util.MissingResourceException;
import java.util.ResourceBundle;
-import net.sourceforge.phpeclipse.wiki.internal.IConfigurationWorkingCopy;
import net.sourceforge.phpeclipse.wiki.internal.ConfigurationManager;
+import net.sourceforge.phpeclipse.wiki.internal.IConfigurationWorkingCopy;
import net.sourceforge.phpeclipse.wiki.sql.WikipediaDB;
import org.eclipse.core.runtime.CoreException;
+ "<config name=\"Koders.com Search\" type-id=\"HTTP Query\" url=\"http://koders.com/?s=$text.selection\"/>"
+ "<config name=\"Leo.org Translation\" type-id=\"HTTP Query\" url=\"http://dict.leo.org/?search=$text.selection\"/>"
+ "<config name=\"Wikipedia-en\" type-id=\"Wikipedia-Load Text\" url=\"http://en.wikipedia.org/w/wiki.phtml?title=$text.wikiname&action=edit\"/>"
- + "<config name=\"Wikibooks-en\" type-id=\"Wikipedia-Load Text\" url=\"http://en.wikibooks.org/w/wiki.phtml?title=$text.wikiname&action=edit\"/>"
+ + "<config name=\"Wikibooks-en\" type-id=\"Wikipedia-Load Text\" url=\"http://en.wikibooks.org/w/index.php?title=$text.wikiname&action=edit\"/>"
+ "<config name=\"Wikipedia-SQL\" type-id=\"Wikipedia SQL access\" user=\"root\" url=\"jdbc:mysql://localhost/wikidb\"/>"
+ "</configurations>";
}
super.shutdown();
}
+
+ public static void log(int severity, String message) {
+ Status status = new Status(severity, PLUGIN_ID, IStatus.OK, message, null);
+ log(status);
+ }
+
+ public static void log(IStatus status) {
+ getDefault().getLog().log(status);
+ }
+
+ public static void log(Throwable e) {
+ log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, "PHPeclipsePlugin.internalErrorOccurred", e)); //$NON-NLS-1$
+ }
+
}
\ No newline at end of file