X-Git-Url: http://git.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java index a414fd1..8ab0b94 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java @@ -112,11 +112,11 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon public static final String PHPPARSER_ORIGINAL = "net.sourceforge.phpdt.internal.compiler.parser.Parser"; + public static final String PHPPARSER_NEW = "test.PHPParser"; + /** Change this if you want to switch PHP Parser. */ public static final String PHPPARSER = PHPPARSER_ORIGINAL; - public static final String PHPPARSER_NEW = "test.PHPParser"; - //The shared instance. private static PHPeclipsePlugin plugin; @@ -396,6 +396,12 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon PreferenceConverter.setDefault(store, PHP_TYPE, PHPColorProvider.TYPE); PreferenceConverter.setDefault(store, PHP_STRING, PHPColorProvider.STRING); PreferenceConverter.setDefault(store, PHP_DEFAULT, PHPColorProvider.DEFAULT); + + PreferenceConverter.setDefault(store, PHPDOC_KEYWORD, PHPColorProvider.PHPDOC_KEYWORD); + PreferenceConverter.setDefault(store, PHPDOC_TAG, PHPColorProvider.PHPDOC_TAG); + PreferenceConverter.setDefault(store, PHPDOC_LINK, PHPColorProvider.PHPDOC_LINK); + PreferenceConverter.setDefault(store, PHPDOC_DEFAULT, PHPColorProvider.PHPDOC_DEFAULT); + // PreferenceConverter.setDefault( // store, // PHP_EDITOR_BACKGROUND, @@ -466,19 +472,17 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon fImageDescriptorRegistry = new ImageDescriptorRegistry(); return fImageDescriptorRegistry; } - /** * Open a file in the Workbench that may or may not exist in the workspace. * Must be run on the UI thread. * @param filename - * @param line * @throws CoreException */ - public void openFileInTextEditor(String filename, int line, String findString) throws CoreException { + public ITextEditor openFileInTextEditor(String filename) throws CoreException { - // reject directories + // reject directories if (new File(filename).isDirectory()) - return; + return null; IWorkbench workbench = PlatformUI.getWorkbench(); IWorkbenchWindow window = workbench.getWorkbenchWindows()[0]; @@ -495,7 +499,7 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon } else { // Otherwise open the stream directly if (page == null) - return; + return null; FileStorage storage = new FileStorage(path); IEditorRegistry registry = getWorkbench().getEditorRegistry(); IEditorDescriptor desc = registry.getDefaultEditor(filename); @@ -514,6 +518,18 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon } } } + return textEditor; + } + /** + * Open a file in the Workbench that may or may not exist in the workspace. + * Must be run on the UI thread. + * @param filename + * @param line + * @throws CoreException + */ + public void openFileAndGotoLine(String filename, int line) throws CoreException { + + ITextEditor textEditor = openFileInTextEditor(filename); if (textEditor != null) { // If a line number was given, go to it if (line > 0) { @@ -526,6 +542,32 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon // invalid text position -> do nothing } } + } + } + + /** + * Open a file in the Workbench that may or may not exist in the workspace. + * Must be run on the UI thread. + * @param filename + * @param offset + * @throws CoreException + */ + public void openFileAndGotoOffset(String filename, int offset, int length) throws CoreException { + + ITextEditor textEditor = openFileInTextEditor(filename); + if (textEditor != null) { + // If a line number was given, go to it + if (offset >= 0) { + IDocument document = textEditor.getDocumentProvider().getDocument(textEditor.getEditorInput()); + textEditor.selectAndReveal(offset, length); + } + } + } + + public void openFileAndFindString(String filename, String findString) throws CoreException { + + ITextEditor textEditor = openFileInTextEditor(filename); + if (textEditor != null) { // If a string was given, go to it if (findString != null) { try { @@ -540,7 +582,6 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon } } } - public void setLastEditorFile(IFile textEditor) { this.fLastEditorFile = textEditor; } @@ -549,8 +590,8 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon * @see org.eclipse.ui.plugin.AbstractUIPlugin#shutdown() */ public void shutdown() throws CoreException { - super.shutdown(); - + super.shutdown(); + // externalTools.shutDown(); ColorManager.getDefault().dispose(); @@ -562,7 +603,7 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon indexManager = (IdentifierIndexManager) iterator.next(); indexManager.writeFile(); } - + } public void startup() throws CoreException {