* Common base class for action contributors for Java editors.
*/
public class SmartyEditorActionContributor extends BasicTextEditorActionContributor {
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IEditorActionBarContributor#setActiveEditor(org.eclipse.ui.IEditorPart)
- */
- public void setActiveEditor(IEditorPart part) {
- super.setActiveEditor(part);
- ITextEditor textEditor = null;
- if (part instanceof ITextEditor)
- textEditor = (ITextEditor) part;
- if (textEditor != null) {
- IFile file = null;
- IEditorInput editorInput = textEditor.getEditorInput();
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IEditorActionBarContributor#setActiveEditor(org.eclipse.ui.IEditorPart)
+ */
+ public void setActiveEditor(IEditorPart part) {
+ super.setActiveEditor(part);
+ ITextEditor textEditor = null;
+ if (part instanceof ITextEditor)
+ textEditor = (ITextEditor) part;
- if (editorInput instanceof IFileEditorInput) {
- file = ((IFileEditorInput) editorInput).getFile();
- }
+ if (textEditor != null) {
+ IFile file = null;
+ IEditorInput editorInput = textEditor.getEditorInput();
- ShowExternalPreviewAction fShowExternalPreviewAction = ShowExternalPreviewAction.getInstance();
- fShowExternalPreviewAction.setEditor(textEditor);
- fShowExternalPreviewAction.update();
- if (fShowExternalPreviewAction != null)
- fShowExternalPreviewAction.doRun(ShowExternalPreviewAction.SMARTY_TYPE);
- }
- }
+ if (editorInput instanceof IFileEditorInput) {
+ file = ((IFileEditorInput) editorInput).getFile();
+ }
+
+ ShowExternalPreviewAction fShowExternalPreviewAction = ShowExternalPreviewAction.getInstance();
+ fShowExternalPreviewAction.setEditor(textEditor);
+ fShowExternalPreviewAction.update();
+ if (fShowExternalPreviewAction != null)
+ fShowExternalPreviewAction.doRun(ShowExternalPreviewAction.SMARTY_TYPE);
+ }
+ }
}
// should never happen
return;
}
- String extension = previewFile.getFileExtension().toLowerCase();
- boolean autoPreview = forceDBGPreview;
- boolean bringToTopPreview = true;
- boolean showHTMLFilesLocal = false;
- boolean showXMLFilesLocal = false;
- boolean isHTMLFileName = false;
- boolean isXMLFileName = false;
- if (!forceDBGPreview) {
- autoPreview = ProjectPrefUtil.getPreviewBooleanValue(previewFile, IPreferenceConstants.PHP_AUTO_PREVIEW_DEFAULT);
-
- bringToTopPreview = ProjectPrefUtil
- .getPreviewBooleanValue(previewFile, IPreferenceConstants.PHP_BRING_TO_TOP_PREVIEW_DEFAULT);
- showHTMLFilesLocal = ProjectPrefUtil.getPreviewBooleanValue(previewFile, IPreferenceConstants.PHP_SHOW_HTML_FILES_LOCAL);
- showXMLFilesLocal = ProjectPrefUtil.getPreviewBooleanValue(previewFile, IPreferenceConstants.PHP_SHOW_XML_FILES_LOCAL);
- isHTMLFileName = "html".equals(extension) || "htm".equals(extension) || "xhtml".equals(extension);
- isXMLFileName = "xml".equals(extension) || "xsd".equals(extension) || "dtd".equals(extension);
- }
- if (autoPreview) {
- String localhostURL;
- if (showHTMLFilesLocal && isHTMLFileName) {
- localhostURL = previewFile.getLocation().toString();
- } else if (showXMLFilesLocal && isXMLFileName) {
- localhostURL = previewFile.getLocation().toString();
- } else if ((localhostURL = ShowExternalPreviewAction.getLocalhostURL(null, previewFile)) == null) {
- return;
+ IWorkbenchPage page = WebUI.getActivePage();
+ if (page!=null && page.isEditorAreaVisible()) {
+ String extension = previewFile.getFileExtension().toLowerCase();
+ boolean autoPreview = forceDBGPreview;
+ boolean showHTMLFilesLocal = false;
+ boolean showXMLFilesLocal = false;
+ boolean isHTMLFileName = false;
+ boolean isXMLFileName = false;
+ if (!forceDBGPreview) {
+ autoPreview = ProjectPrefUtil.getPreviewBooleanValue(previewFile, IPreferenceConstants.PHP_AUTO_PREVIEW_DEFAULT);
+
+ showHTMLFilesLocal = ProjectPrefUtil.getPreviewBooleanValue(previewFile, IPreferenceConstants.PHP_SHOW_HTML_FILES_LOCAL);
+ showXMLFilesLocal = ProjectPrefUtil.getPreviewBooleanValue(previewFile, IPreferenceConstants.PHP_SHOW_XML_FILES_LOCAL);
+ isHTMLFileName = "html".equals(extension) || "htm".equals(extension) || "xhtml".equals(extension);
+ isXMLFileName = "xml".equals(extension) || "xsd".equals(extension) || "dtd".equals(extension);
}
- localhostURL += postFix;
+ if (autoPreview) {
+ String localhostURL;
+ if (showHTMLFilesLocal && isHTMLFileName) {
+ localhostURL = previewFile.getLocation().toString();
+ } else if (showXMLFilesLocal && isXMLFileName) {
+ localhostURL = previewFile.getLocation().toString();
+ } else if ((localhostURL = ShowExternalPreviewAction.getLocalhostURL(null, previewFile)) == null) {
+ return;
+ }
+ localhostURL += postFix;
- try {
- IWorkbenchPage page = WebUI.getActivePage();
- IViewPart part = page.showView(BrowserView.ID_BROWSER, null, IWorkbenchPage.VIEW_VISIBLE);
- // if (part == null) {
- // part = page.showView(BrowserView.ID_BROWSER);
- // } else {
- if (part != null) {
- if (bringToTopPreview) {
+ try {
+ IViewPart part = page.showView(BrowserView.ID_BROWSER, null, IWorkbenchPage.VIEW_VISIBLE);
+ if (part == null) {
+ part = page.showView(BrowserView.ID_BROWSER);
+ } else {
page.bringToTop(part);
}
((BrowserView) part).setUrl(localhostURL);
- }
- // }
- } catch (Exception e) {
- // PHPeclipsePlugin.log(e);
+ } catch (Exception e) {
+ // PHPeclipsePlugin.log(e);
+ }
}
}
}
# Contributors:
# Christopher Lenz - initial english resources
#
-# $Id: plugin.properties,v 1.2 2004-09-04 08:59:28 jsurfer Exp $
+# $Id: plugin.properties,v 1.3 2005-07-10 15:16:13 axelcl Exp $
#
pluginName = PHPeclipse Web Development Tools XML UI
xmlEditorName = XML Editor
dtdEditorName = DTD Editor
-xmlEditorPreferencePageName = HTML/XML Editor
+xmlEditorPreferencePageName = HTML in PHP Editor
templates.xml.contextType.name = XML Context
templates.html.contextType.name = HTML Context
\ No newline at end of file
<import plugin="org.eclipse.ui.workbench.texteditor"/>
</requires>
-
<extension
point="org.eclipse.core.runtime.preferences">
<initializer class="net.sourceforge.phpeclipse.xml.ui.internal.preferences.XMLPreferenceInitializer"/>
* Common base class for action contributors for Java editors.
*/
public class XMLEditorActionContributor extends BasicTextEditorActionContributor {
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IEditorActionBarContributor#setActiveEditor(org.eclipse.ui.IEditorPart)
- */
- public void setActiveEditor(IEditorPart part) {
- super.setActiveEditor(part);
- ITextEditor textEditor = null;
- if (part instanceof ITextEditor)
- textEditor = (ITextEditor) part;
- if (textEditor != null) {
- IFile file = null;
- IEditorInput editorInput = textEditor.getEditorInput();
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IEditorActionBarContributor#setActiveEditor(org.eclipse.ui.IEditorPart)
+ */
+ public void setActiveEditor(IEditorPart part) {
+ super.setActiveEditor(part);
+ ITextEditor textEditor = null;
+ if (part instanceof ITextEditor)
+ textEditor = (ITextEditor) part;
- if (editorInput instanceof IFileEditorInput) {
- file = ((IFileEditorInput) editorInput).getFile();
- }
+ if (textEditor != null) {
+ IFile file = null;
+ IEditorInput editorInput = textEditor.getEditorInput();
- ShowExternalPreviewAction fShowExternalPreviewAction = ShowExternalPreviewAction.getInstance();
- fShowExternalPreviewAction.setEditor(textEditor);
- fShowExternalPreviewAction.update();
- if (fShowExternalPreviewAction != null)
- fShowExternalPreviewAction.doRun(ShowExternalPreviewAction.PHP_TYPE);
- }
- }
+ if (editorInput instanceof IFileEditorInput) {
+ file = ((IFileEditorInput) editorInput).getFile();
+ }
+
+ ShowExternalPreviewAction fShowExternalPreviewAction = ShowExternalPreviewAction.getInstance();
+ fShowExternalPreviewAction.setEditor(textEditor);
+ fShowExternalPreviewAction.update();
+ if (fShowExternalPreviewAction != null)
+ fShowExternalPreviewAction.doRun(ShowExternalPreviewAction.PHP_TYPE);
+ }
+ }
}
}
PHPeclipsePlugin.getDefault().setLastEditorFile(file);
-
+
ShowExternalPreviewAction fShowExternalPreviewAction = ShowExternalPreviewAction.getInstance();
fShowExternalPreviewAction.setEditor(textEditor);
fShowExternalPreviewAction.update();
import net.sourceforge.phpdt.ui.text.PHPSourceViewerConfiguration;
import net.sourceforge.phpdt.ui.text.folding.IJavaFoldingStructureProvider;
import net.sourceforge.phpeclipse.PHPeclipsePlugin;
+import net.sourceforge.phpeclipse.ui.editor.ShowExternalPreviewAction;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
JavaTextTools textTools = PHPeclipsePlugin.getDefault().getJavaTextTools();
setSourceViewerConfiguration(new PHPSourceViewerConfiguration(textTools.getColorManager(), store, this,
IPHPPartitions.PHP_PARTITIONING));
+
// TODO changed in 3.x ?
// setRangeIndicator(new DefaultRangeIndicator());
// if (PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE))