* 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;
/**
*
*/
-public class ModelBasedOutlinePage extends ContentOutlinePage
- implements IUpdate {
+public class ModelBasedOutlinePage extends ContentOutlinePage implements
+ IUpdate {
// Inner Classes -----------------------------------------------------------
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);
*/
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);
}
}
/**
* Constructor.
*
- * @param editor The associated structured text editor
+ * @param editor
+ * The associated structured text editor
*/
public ModelBasedOutlinePage(StructuredTextEditor editor) {
this.editor = editor;
}
/*
- * @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());
}
/**
* 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) {