Update MANIFEST.MF, replaced deprecated Provide-Package with Export-Package.
[phpeclipse.git] / net.sourceforge.phpeclipse.ui / src / net / sourceforge / phpeclipse / ui / views / outline / ModelBasedOutlinePage.java
index 8f9fda4..4a4709e 100644 (file)
@@ -8,7 +8,7 @@
  * Contributors:
  *     Christopher Lenz - initial implementation
  * 
- * $Id: ModelBasedOutlinePage.java,v 1.1 2004-09-02 18:26:28 jsurfer Exp $
+ * $Id: ModelBasedOutlinePage.java,v 1.2 2006-10-21 23:13:54 pombredanne Exp $
  */
 
 package net.sourceforge.phpeclipse.ui.views.outline;
@@ -40,8 +40,8 @@ import org.eclipse.ui.views.contentoutline.ContentOutlinePage;
 /**
  * 
  */
-public class ModelBasedOutlinePage extends ContentOutlinePage
-       implements IUpdate {
+public class ModelBasedOutlinePage extends ContentOutlinePage implements
+               IUpdate {
 
        // Inner Classes -----------------------------------------------------------
 
@@ -81,41 +81,42 @@ public class ModelBasedOutlinePage extends ContentOutlinePage
                        return model.getElements();
                }
 
-               /* 
+               /*
                 * @see org.eclipse.jface.viewers.IContentProvider#dispose()
                 */
                public void dispose() {
                }
 
                /*
-                * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(Viewer, Object, Object)
+                * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(Viewer,
+                *      Object, Object)
                 */
                public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
                        if (oldInput != newInput) {
                                if (newInput instanceof ISourceModel) {
                                        model = (ISourceModel) newInput;
-                               }          
+                               }
                        }
                }
 
        }
 
        /**
-        * This action toggles whether this outline page links its selection
-        * to the active editor.
+        * This action toggles whether this outline page links its selection to the
+        * active editor.
         */
        private class ToggleLinkingAction extends ResourceAction {
-               
+
                /**
                 * Constructs a new action.
                 */
                public ToggleLinkingAction() {
                        super(WebUIMessages.getResourceBundle(),
-                               "OutlinePage.linkWithEditor."); //$NON-NLS-1$
+                                       "OutlinePage.linkWithEditor."); //$NON-NLS-1$
                        if ((preferenceStore != null)
-                        && (linkWithEditorPreferenceKey != null)) {
-                               boolean checked = preferenceStore.getBoolean(
-                                               linkWithEditorPreferenceKey);
+                                       && (linkWithEditorPreferenceKey != null)) {
+                               boolean checked = preferenceStore
+                                               .getBoolean(linkWithEditorPreferenceKey);
                                valueChanged(checked, false);
                        } else {
                                setEnabled(false);
@@ -127,31 +128,32 @@ public class ModelBasedOutlinePage extends ContentOutlinePage
                 */
                public void run() {
                        if ((preferenceStore != null)
-                        && (linkWithEditorPreferenceKey != null)) {
+                                       && (linkWithEditorPreferenceKey != null)) {
                                valueChanged(isChecked(), true);
                        }
                }
-       
+
                // Private Methods -----------------------------------------------------
 
                /**
                 * Updates whether the outline page is linked to the active editor.
                 * 
-                * @param checked Whether linking is enabled
-                * @param store Whether the new state should be written back as a 
-                *        preference
+                * @param checked
+                *            Whether linking is enabled
+                * @param store
+                *            Whether the new state should be written back as a
+                *            preference
                 */
                private void valueChanged(final boolean checked, boolean store) {
                        setChecked(checked);
                        BusyIndicator.showWhile(getTreeViewer().getControl().getDisplay(),
-                               new Runnable() {
-                                       public void run() {
-                                               editor.synchronizeOutlinePage();
-                                       }
-                               });
+                                       new Runnable() {
+                                               public void run() {
+                                                       editor.synchronizeOutlinePage();
+                                               }
+                                       });
                        if (store) {
-                               preferenceStore.setValue(
-                                       linkWithEditorPreferenceKey, checked);
+                               preferenceStore.setValue(linkWithEditorPreferenceKey, checked);
                        }
                }
 
@@ -185,7 +187,8 @@ public class ModelBasedOutlinePage extends ContentOutlinePage
        /**
         * Constructor.
         * 
-        * @param editor The associated structured text editor
+        * @param editor
+        *            The associated structured text editor
         */
        public ModelBasedOutlinePage(StructuredTextEditor editor) {
                this.editor = editor;
@@ -214,10 +217,11 @@ public class ModelBasedOutlinePage extends ContentOutlinePage
        }
 
        /*
-        * @see org.eclipse.ui.part.Page#makeContributions(IMenuManager, IToolBarManager, IStatusLineManager)
+        * @see org.eclipse.ui.part.Page#makeContributions(IMenuManager,
+        *      IToolBarManager, IStatusLineManager)
         */
        public void makeContributions(IMenuManager menuManager,
-               IToolBarManager toolBarManager, IStatusLineManager statusLineManager) {
+                       IToolBarManager toolBarManager, IStatusLineManager statusLineManager) {
                if (toolBarManager != null) {
                        toolBarManager.add(new ToggleLinkingAction());
                }
@@ -250,15 +254,15 @@ public class ModelBasedOutlinePage extends ContentOutlinePage
        /**
         * Selects a specific element in the outline page.
         * 
-        * @param element the element to select
+        * @param element
+        *            the element to select
         */
        public void select(ISourceReference element) {
                TreeViewer viewer = getTreeViewer();
                if (viewer != null) {
                        ISelection selection = viewer.getSelection();
                        if (selection instanceof IStructuredSelection) {
-                               IStructuredSelection structuredSelection =
-                                       (IStructuredSelection) selection;
+                               IStructuredSelection structuredSelection = (IStructuredSelection) selection;
                                List elements = structuredSelection.toList();
                                if (!elements.contains(element)) {
                                        if (element == null) {