X-Git-Url: http://secure.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPEditor.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPEditor.java index 4eb14da..d144789 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPEditor.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPEditor.java @@ -64,12 +64,15 @@ import net.sourceforge.phpeclipse.PHPeclipsePlugin; import net.sourceforge.phpeclipse.ui.editor.BrowserUtil; import net.sourceforge.phpeclipse.webbrowser.views.BrowserView; +import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IMarker; import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Preferences; import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.jobs.Job; @@ -176,6 +179,7 @@ import org.eclipse.ui.actions.ActionGroup; import org.eclipse.ui.editors.text.DefaultEncodingSupport; import org.eclipse.ui.editors.text.EditorsUI; import org.eclipse.ui.editors.text.IEncodingSupport; +import org.eclipse.ui.ide.FileStoreEditorInput; import org.eclipse.ui.part.FileEditorInput; import org.eclipse.ui.part.IShowInSource; import org.eclipse.ui.part.IShowInTargetList; @@ -2370,7 +2374,7 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements } } - + /** * Finds the next position after the given position. * @@ -3198,7 +3202,7 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements * Default constructor. */ public PHPEditor() { - super(); + super(); } /* @@ -3226,7 +3230,7 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements setSourceViewerConfiguration(new PHPSourceViewerConfiguration(textTools .getColorManager(), store, this, IPHPPartitions.PHP_PARTITIONING)); - + // TODO changed in 3.x ? // setRangeIndicator(new DefaultRangeIndicator()); // if @@ -3373,7 +3377,6 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements Preferences preferences = PHPeclipsePlugin.getDefault() .getPluginPreferences(); preferences.addPropertyChangeListener(fPropertyChangeListener); - IInformationControlCreator informationControlCreator = new IInformationControlCreator() { public IInformationControl createInformationControl(Shell parent) { boolean cutDown = false; @@ -3402,7 +3405,32 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements installOccurrencesFinder(); PlatformUI.getWorkbench().addWindowListener(fActivationListener); - + + /* + * start of EDITOR_SAVE_ON_BLUR + * ed_mann + */ + final PHPEditor editor = this; + FocusListener focusListener = new FocusListener() { + + public void focusGained(FocusEvent e) { + return; + } + + public void focusLost(FocusEvent e) { + //viewer.get + if(editor.isDirty() && PHPeclipsePlugin.getDefault().getPreferenceStore() + .getBoolean(PreferenceConstants.EDITOR_SAVE_ON_BLUR)){ + editor.doSave(null); + } + } + }; + projectionViewer.getTextWidget().addFocusListener(focusListener); + /* + * end of EDITOR_SAVE_ON_BLUR + * ed_mann + */ + setWordWrap(); } @@ -5848,13 +5876,20 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements } public ShowInContext getShowInContext() { - FileEditorInput fei = (FileEditorInput) getEditorInput(); - ShowInContext context = BrowserUtil.getShowInContext(fei.getFile(), + IFile file; + if(getEditorInput() instanceof FileStoreEditorInput){ + FileStoreEditorInput fei = (FileStoreEditorInput) getEditorInput(); + file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(fei.getURI().getPath())); + } else { + FileEditorInput fei = (FileEditorInput) getEditorInput(); + file = ResourcesPlugin.getWorkspace().getRoot().getFile(fei.getPath()); + } + ShowInContext context = BrowserUtil.getShowInContext(file, false, ""); if (context != null) { return context; } - return new ShowInContext(fei.getFile(), null); + return new ShowInContext(file, null); } public String[] getShowInTargetIds() {