mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-17 05:05:43 +02:00
Adds default preference pages for the C- and Makefile Editor; Toni's patch for bug 138212
This commit is contained in:
parent
0b807e8a44
commit
159945250e
2 changed files with 43 additions and 30 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2005 QNX Software Systems and others.
|
* Copyright (c) 2000, 2006 QNX Software Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* QNX Software Systems - Initial API and implementation
|
* QNX Software Systems - Initial API and implementation
|
||||||
|
* Anton Leherbauer, Wind River Systems, Inc.
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.make.internal.ui.editor;
|
package org.eclipse.cdt.make.internal.ui.editor;
|
||||||
|
|
||||||
|
@ -17,40 +18,21 @@ import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
|
||||||
import org.eclipse.cdt.make.internal.ui.preferences.MakefileEditorPreferenceConstants;
|
import org.eclipse.cdt.make.internal.ui.preferences.MakefileEditorPreferenceConstants;
|
||||||
import org.eclipse.cdt.make.internal.ui.text.makefile.MakefileWordDetector;
|
import org.eclipse.cdt.make.internal.ui.text.makefile.MakefileWordDetector;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
import org.eclipse.core.runtime.ListenerList;
|
||||||
import org.eclipse.jface.action.IAction;
|
import org.eclipse.jface.action.IAction;
|
||||||
import org.eclipse.jface.action.IMenuManager;
|
import org.eclipse.jface.action.IMenuManager;
|
||||||
import org.eclipse.jface.preference.IPreferenceStore;
|
import org.eclipse.jface.preference.IPreferenceStore;
|
||||||
import org.eclipse.jface.text.BadLocationException;
|
import org.eclipse.jface.text.*;
|
||||||
import org.eclipse.jface.text.FindReplaceDocumentAdapter;
|
|
||||||
import org.eclipse.jface.text.IDocument;
|
|
||||||
import org.eclipse.jface.text.IRegion;
|
|
||||||
import org.eclipse.jface.text.ITextOperationTarget;
|
|
||||||
import org.eclipse.jface.text.ITextViewerExtension;
|
|
||||||
import org.eclipse.jface.text.rules.IWordDetector;
|
import org.eclipse.jface.text.rules.IWordDetector;
|
||||||
import org.eclipse.jface.text.source.IOverviewRuler;
|
import org.eclipse.jface.text.source.*;
|
||||||
import org.eclipse.jface.text.source.ISourceViewer;
|
import org.eclipse.jface.text.source.projection.*;
|
||||||
import org.eclipse.jface.text.source.IVerticalRuler;
|
|
||||||
import org.eclipse.jface.text.source.SourceViewerConfiguration;
|
|
||||||
import org.eclipse.jface.text.source.projection.ProjectionAnnotationModel;
|
|
||||||
import org.eclipse.jface.text.source.projection.ProjectionSupport;
|
|
||||||
import org.eclipse.jface.text.source.projection.ProjectionViewer;
|
|
||||||
import org.eclipse.jface.util.ListenerList;
|
|
||||||
import org.eclipse.jface.util.PropertyChangeEvent;
|
import org.eclipse.jface.util.PropertyChangeEvent;
|
||||||
import org.eclipse.jface.viewers.ISelection;
|
import org.eclipse.jface.viewers.*;
|
||||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
|
||||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
|
||||||
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.ui.IPartService;
|
import org.eclipse.ui.*;
|
||||||
import org.eclipse.ui.IWorkbenchPart;
|
|
||||||
import org.eclipse.ui.IWorkbenchWindow;
|
|
||||||
import org.eclipse.ui.editors.text.EditorsUI;
|
import org.eclipse.ui.editors.text.EditorsUI;
|
||||||
import org.eclipse.ui.editors.text.TextEditor;
|
import org.eclipse.ui.editors.text.TextEditor;
|
||||||
import org.eclipse.ui.texteditor.ChainedPreferenceStore;
|
import org.eclipse.ui.texteditor.*;
|
||||||
import org.eclipse.ui.texteditor.DefaultRangeIndicator;
|
|
||||||
import org.eclipse.ui.texteditor.ITextEditorActionConstants;
|
|
||||||
import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
|
|
||||||
import org.eclipse.ui.texteditor.TextOperationAction;
|
|
||||||
import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
|
import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
|
||||||
|
|
||||||
public class MakefileEditor extends TextEditor implements ISelectionChangedListener, IReconcilingParticipant {
|
public class MakefileEditor extends TextEditor implements ISelectionChangedListener, IReconcilingParticipant {
|
||||||
|
@ -67,7 +49,7 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe
|
||||||
* Reconciling listeners.
|
* Reconciling listeners.
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
private ListenerList fReconcilingListeners= new ListenerList();
|
private ListenerList fReconcilingListeners= new ListenerList(ListenerList.IDENTITY);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adapted source viewer for CEditor
|
* Adapted source viewer for CEditor
|
||||||
|
@ -163,7 +145,7 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe
|
||||||
projectionViewer.doOperation(ProjectionViewer.TOGGLE);
|
projectionViewer.doOperation(ProjectionViewer.TOGGLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectionAnnotationModel model= (ProjectionAnnotationModel) getAdapter(ProjectionAnnotationModel.class);
|
// ProjectionAnnotationModel model= (ProjectionAnnotationModel) getAdapter(ProjectionAnnotationModel.class);
|
||||||
|
|
||||||
fProjectionMakefileUpdater= new ProjectionMakefileUpdater();
|
fProjectionMakefileUpdater= new ProjectionMakefileUpdater();
|
||||||
if (fProjectionMakefileUpdater != null) {
|
if (fProjectionMakefileUpdater != null) {
|
||||||
|
@ -433,4 +415,18 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe
|
||||||
|
|
||||||
super.handlePreferenceStoreChanged(event);
|
super.handlePreferenceStoreChanged(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#collectContextMenuPreferencePages()
|
||||||
|
*/
|
||||||
|
protected String[] collectContextMenuPreferencePages() {
|
||||||
|
// Add Makefile Editor relevant pages
|
||||||
|
String[] parentPrefPageIds = super.collectContextMenuPreferencePages();
|
||||||
|
String[] prefPageIds = new String[parentPrefPageIds.length + 2];
|
||||||
|
int nIds = 0;
|
||||||
|
prefPageIds[nIds++] = "org.eclipse.cdt.make.ui.preferences.MakeFileEditorPreferencePage"; //$NON-NLS-1$
|
||||||
|
prefPageIds[nIds++] = "org.eclipse.cdt.make.ui.preferences.MakefileSettingPreferencePage"; //$NON-NLS-1$
|
||||||
|
System.arraycopy(parentPrefPageIds, 0, prefPageIds, nIds, parentPrefPageIds.length);
|
||||||
|
return prefPageIds;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2005 IBM Corporation and others.
|
* Copyright (c) 2005, 2006 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -8,6 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Corporation - initial API and implementation
|
* IBM Corporation - initial API and implementation
|
||||||
* QNX Software System
|
* QNX Software System
|
||||||
|
* Anton Leherbauer, Wind River Systems, Inc.
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui.editor;
|
package org.eclipse.cdt.internal.ui.editor;
|
||||||
|
|
||||||
|
@ -1455,4 +1456,20 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IS
|
||||||
}
|
}
|
||||||
return cViewer ;
|
return cViewer ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#collectContextMenuPreferencePages()
|
||||||
|
*/
|
||||||
|
protected String[] collectContextMenuPreferencePages() {
|
||||||
|
// Add C/C++ Editor relevant pages
|
||||||
|
String[] parentPrefPageIds = super.collectContextMenuPreferencePages();
|
||||||
|
String[] prefPageIds = new String[parentPrefPageIds.length + 4];
|
||||||
|
int nIds = 0;
|
||||||
|
prefPageIds[nIds++] = "org.eclipse.cdt.ui.preferences.CEditorPreferencePage"; //$NON-NLS-1$
|
||||||
|
prefPageIds[nIds++] = "org.eclipse.cdt.ui.preferences.CodeAssistPreferencePage"; //$NON-NLS-1$
|
||||||
|
prefPageIds[nIds++] = "org.eclipse.cdt.ui.preferences.TemplatePreferencePage"; //$NON-NLS-1$
|
||||||
|
prefPageIds[nIds++] = "org.eclipse.cdt.ui.preferences.CodeFormatterPreferencePage"; //$NON-NLS-1$
|
||||||
|
System.arraycopy(parentPrefPageIds, 0, prefPageIds, nIds, parentPrefPageIds.length);
|
||||||
|
return prefPageIds;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue