mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-09 09:15:38 +02:00
Cosmetics.
This commit is contained in:
parent
a7b73d776c
commit
62776c27d6
5 changed files with 46 additions and 73 deletions
|
@ -67,14 +67,11 @@ class PDOMCFunction extends PDOMBinding implements IFunction {
|
|||
public PDOMCFunction(PDOMLinkage linkage, PDOMNode parent, IFunction function) throws CoreException {
|
||||
super(linkage, parent, function.getNameCharArray());
|
||||
|
||||
IFunctionType type;
|
||||
IParameter[] parameters;
|
||||
byte annotations;
|
||||
type = function.getType();
|
||||
parameters = function.getParameters();
|
||||
annotations = PDOMCAnnotation.encodeAnnotation(function);
|
||||
IFunctionType type = function.getType();
|
||||
setType(getLinkage(), type);
|
||||
IParameter[] parameters = function.getParameters();
|
||||
setParameters(parameters);
|
||||
byte annotations = PDOMCAnnotation.encodeAnnotation(function);
|
||||
getDB().putByte(record + ANNOTATIONS, annotations);
|
||||
}
|
||||
|
||||
|
@ -84,19 +81,16 @@ class PDOMCFunction extends PDOMBinding implements IFunction {
|
|||
return;
|
||||
|
||||
IFunction func= (IFunction) newBinding;
|
||||
IFunctionType newType;
|
||||
IParameter[] newParams;
|
||||
byte newAnnotation;
|
||||
newType= func.getType();
|
||||
newParams = func.getParameters();
|
||||
newAnnotation = PDOMCAnnotation.encodeAnnotation(func);
|
||||
|
||||
IFunctionType newType = func.getType();
|
||||
setType(linkage, newType);
|
||||
|
||||
PDOMCParameter oldParams= getFirstParameter(null);
|
||||
IParameter[] newParams = func.getParameters();
|
||||
setParameters(newParams);
|
||||
if (oldParams != null) {
|
||||
oldParams.delete(linkage);
|
||||
}
|
||||
byte newAnnotation = PDOMCAnnotation.encodeAnnotation(func);
|
||||
getDB().putByte(record + ANNOTATIONS, newAnnotation);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005, 2013 IBM Corporation and others.
|
||||
* Copyright (c) 2005, 2014 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -18,7 +18,9 @@
|
|||
package org.eclipse.cdt.internal.ui.editor;
|
||||
|
||||
import java.text.CharacterIterator;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Deque;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
@ -26,7 +28,6 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.ResourceBundle;
|
||||
import java.util.Set;
|
||||
import java.util.Stack;
|
||||
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IMarker;
|
||||
|
@ -399,10 +400,10 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
|||
private class ExitPolicy implements IExitPolicy {
|
||||
final char fExitCharacter;
|
||||
final char fEscapeCharacter;
|
||||
final Stack<BracketLevel> fStack;
|
||||
final Deque<BracketLevel> fStack;
|
||||
final int fSize;
|
||||
|
||||
public ExitPolicy(char exitCharacter, char escapeCharacter, Stack<BracketLevel> stack) {
|
||||
public ExitPolicy(char exitCharacter, char escapeCharacter, Deque<BracketLevel> stack) {
|
||||
fExitCharacter = exitCharacter;
|
||||
fEscapeCharacter = escapeCharacter;
|
||||
fStack = stack;
|
||||
|
@ -536,7 +537,7 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
|||
private boolean fCloseAngularBrackets = true;
|
||||
private final String CATEGORY = toString();
|
||||
private IPositionUpdater fUpdater = new ExclusivePositionUpdater(CATEGORY);
|
||||
private Stack<BracketLevel> fBracketLevelStack = new Stack<BracketLevel>();
|
||||
private Deque<BracketLevel> fBracketLevelStack = new ArrayDeque<>();
|
||||
|
||||
public void setCloseBracketsEnabled(boolean enabled) {
|
||||
fCloseBrackets = enabled;
|
||||
|
@ -1243,7 +1244,7 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
|||
|
||||
private final ListenerList fPostSaveListeners;
|
||||
|
||||
private static final Set<String> angularIntroducers = new HashSet<String>();
|
||||
private static final Set<String> angularIntroducers = new HashSet<>();
|
||||
static {
|
||||
angularIntroducers.add("template"); //$NON-NLS-1$
|
||||
angularIntroducers.add("vector"); //$NON-NLS-1$
|
||||
|
@ -3100,7 +3101,7 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
|||
|
||||
// Add occurrence annotations
|
||||
int length= fLocations.length;
|
||||
Map<Annotation, Position> annotationMap= new HashMap<Annotation, Position>(length);
|
||||
Map<Annotation, Position> annotationMap= new HashMap<>(length);
|
||||
for (int i= 0; i < length; i++) {
|
||||
if (isCanceled(progressMonitor))
|
||||
return Status.CANCEL_STATUS;
|
||||
|
@ -3367,7 +3368,7 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
|||
* @return the preference store for this editor
|
||||
*/
|
||||
private IPreferenceStore createCombinedPreferenceStore(IEditorInput input) {
|
||||
List<IPreferenceStore> stores= new ArrayList<IPreferenceStore>(3);
|
||||
List<IPreferenceStore> stores= new ArrayList<>(3);
|
||||
|
||||
ICProject project= EditorUtility.getCProject(input);
|
||||
if (project != null) {
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.ui.editor;
|
||||
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -29,13 +28,11 @@ import org.eclipse.cdt.ui.IWorkingCopyManagerExtension;
|
|||
import org.eclipse.cdt.internal.core.model.CModelManager;
|
||||
import org.eclipse.cdt.internal.core.model.IBufferFactory;
|
||||
|
||||
|
||||
/**
|
||||
* This working copy manager works together with a given compilation unit document provider and
|
||||
* additionally offers to "overwrite" the working copy provided by this document provider.
|
||||
*/
|
||||
public class WorkingCopyManager implements IWorkingCopyManager, IWorkingCopyManagerExtension {
|
||||
|
||||
private CDocumentProvider fDocumentProvider;
|
||||
private Map<IEditorInput, IWorkingCopy> fMap;
|
||||
private boolean fIsShuttingDown;
|
||||
|
@ -52,25 +49,16 @@ public class WorkingCopyManager implements IWorkingCopyManager, IWorkingCopyMana
|
|||
fDocumentProvider= provider;
|
||||
}
|
||||
|
||||
/*
|
||||
* @see org.eclipse.cdt.ui.IWorkingCopyManager#connect(org.eclipse.ui.IEditorInput)
|
||||
*/
|
||||
@Override
|
||||
public void connect(IEditorInput input) throws CoreException {
|
||||
fDocumentProvider.connect(input);
|
||||
}
|
||||
|
||||
/*
|
||||
* @see org.eclipse.cdt.ui.IWorkingCopyManager#disconnect(org.eclipse.ui.IEditorInput)
|
||||
*/
|
||||
@Override
|
||||
public void disconnect(IEditorInput input) {
|
||||
fDocumentProvider.disconnect(input);
|
||||
}
|
||||
|
||||
/*
|
||||
* @see org.eclipse.cdt.ui.IWorkingCopyManager#shutdown()
|
||||
*/
|
||||
@Override
|
||||
public void shutdown() {
|
||||
if (!fIsShuttingDown) {
|
||||
|
@ -87,30 +75,21 @@ public class WorkingCopyManager implements IWorkingCopyManager, IWorkingCopyMana
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* @see org.eclipse.cdt.ui.IWorkingCopyManager#getWorkingCopy(org.eclipse.ui.IEditorInput)
|
||||
*/
|
||||
@Override
|
||||
public IWorkingCopy getWorkingCopy(IEditorInput input) {
|
||||
IWorkingCopy unit= fMap == null ? null : fMap.get(input);
|
||||
return unit != null ? unit : fDocumentProvider.getWorkingCopy(input);
|
||||
}
|
||||
|
||||
/*
|
||||
* @see org.eclipse.cdt.internal.ui.editor.IWorkingCopyManagerExtension#setWorkingCopy(org.eclipse.ui.IEditorInput, org.eclipse.cdt.core.model.ITranslationUnit)
|
||||
*/
|
||||
@Override
|
||||
public void setWorkingCopy(IEditorInput input, IWorkingCopy workingCopy) {
|
||||
if (fDocumentProvider.getDocument(input) != null) {
|
||||
if (fMap == null)
|
||||
fMap= new HashMap<IEditorInput, IWorkingCopy>();
|
||||
fMap= new HashMap<>();
|
||||
fMap.put(input, workingCopy);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* @see org.eclipse.cdt.internal.ui.editor.IWorkingCopyManagerExtension#removeWorkingCopy(org.eclipse.ui.IEditorInput)
|
||||
*/
|
||||
@Override
|
||||
public void removeWorkingCopy(IEditorInput input) {
|
||||
fMap.remove(input);
|
||||
|
|
|
@ -20,26 +20,23 @@ import org.eclipse.cdt.core.model.ITranslationUnit;
|
|||
import org.eclipse.cdt.core.model.IWorkingCopy;
|
||||
|
||||
/**
|
||||
* Interface for accessing working copies of <code>ITranslationUnit</code>
|
||||
* Interface for accessing working copies of {@code ITranslationUnit}
|
||||
* objects. The original translation unit is only given indirectly by means
|
||||
* of an <code>IEditorInput</code>. The life cycle is as follows:
|
||||
* of an {@code IEditorInput}. The life cycle is as follows:
|
||||
* <ul>
|
||||
* <li> <code>connect</code> creates and remembers a working copy of the
|
||||
* translation unit which is encoded in the given editor input</li>
|
||||
* <li> <code>getWorkingCopy</code> returns the working copy remembered on
|
||||
* <code>connect</code></li>
|
||||
* <li> <code>disconnect</code> destroys the working copy remembered on
|
||||
* <code>connect</code></li>
|
||||
* <li> {@code connect} creates and remembers a working copy of the
|
||||
* translation unit which is encoded in the given editor input</li>
|
||||
* <li> {@code getWorkingCopy} returns the working copy remembered on
|
||||
* {@code connect}</li>
|
||||
* <li> {@code disconnect} destroys the working copy remembered on
|
||||
* {@code connect}</li>
|
||||
* </ul>
|
||||
* <p>
|
||||
* This interface is not intended to be implemented by clients.
|
||||
* </p>
|
||||
* @noimplement This interface is not intended to be implemented by clients.
|
||||
*
|
||||
* @see CDTUITools#getWorkingCopyManager
|
||||
*/
|
||||
public interface IWorkingCopyManager {
|
||||
|
||||
/**
|
||||
* Connects the given editor input to this manager. After calling
|
||||
* this method, a working copy will be available for the translation unit encoded
|
||||
|
@ -47,7 +44,7 @@ public interface IWorkingCopyManager {
|
|||
*
|
||||
* @param input the editor input
|
||||
* @exception CoreException if the working copy cannot be created for the
|
||||
* translation unit
|
||||
* translation unit
|
||||
*/
|
||||
void connect(IEditorInput input) throws CoreException;
|
||||
|
||||
|
@ -67,9 +64,9 @@ public interface IWorkingCopyManager {
|
|||
* the given editor input.
|
||||
*
|
||||
* @param input the editor input
|
||||
* @return the working copy of the translation unit, or <code>null</code> if the
|
||||
* input does not encode an editor input, or if there is no remembered working
|
||||
* copy for this translation unit
|
||||
* @return the working copy of the translation unit, or {@code null} if the
|
||||
* input does not encode an editor input, or if there is no remembered working
|
||||
* copy for this translation unit
|
||||
*/
|
||||
IWorkingCopy getWorkingCopy(IEditorInput input);
|
||||
|
||||
|
@ -82,12 +79,14 @@ public interface IWorkingCopyManager {
|
|||
/**
|
||||
* Returns a shared working copy for the given translation unit. If necessary, a new
|
||||
* working copy will be created.
|
||||
*
|
||||
* @param tu a translation unit
|
||||
* @param requestor call back interface for reporting problems, may be <code>null</code>.
|
||||
* @param requestor call back interface for reporting problems, may be {@code null}.
|
||||
* @param monitor a monitor to report progress
|
||||
* @since 5.2
|
||||
*/
|
||||
IWorkingCopy getSharedWorkingCopy(ITranslationUnit tu, IProblemRequestor requestor, IProgressMonitor monitor) throws CModelException;
|
||||
IWorkingCopy getSharedWorkingCopy(ITranslationUnit tu, IProblemRequestor requestor,
|
||||
IProgressMonitor monitor) throws CModelException;
|
||||
|
||||
/**
|
||||
* Returns all shared working copies, currently available.
|
||||
|
@ -96,9 +95,9 @@ public interface IWorkingCopyManager {
|
|||
IWorkingCopy[] getSharedWorkingCopies();
|
||||
|
||||
/**
|
||||
* Returns the shared working copy for the given translation unit, if it exists, or <code>null</code>, otherwise.
|
||||
* Returns the shared working copy for the given translation unit, if it exists,
|
||||
* or {@code null}, otherwise.
|
||||
* @since 5.2
|
||||
*/
|
||||
IWorkingCopy findSharedWorkingCopy(ITranslationUnit tu);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,29 +1,29 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2008 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
* Copyright (c) 2000, 2008 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.ui;
|
||||
|
||||
import org.eclipse.cdt.core.model.IWorkingCopy;
|
||||
import org.eclipse.ui.IEditorInput;
|
||||
|
||||
import org.eclipse.cdt.core.model.IWorkingCopy;
|
||||
|
||||
/**
|
||||
* Extension interface for <code>IWorkingCopyManager</code>.
|
||||
* Extension interface for {@code IWorkingCopyManager}.
|
||||
* @noimplement This interface is not intended to be implemented by clients.
|
||||
* @since 2.1
|
||||
*/
|
||||
public interface IWorkingCopyManagerExtension {
|
||||
|
||||
/**
|
||||
* Sets the given working copy for the given editor input. If the given editor input
|
||||
* is not connected to this working copy manager, this call has no effect. <p>
|
||||
* is not connected to this working copy manager, this call has no effect.
|
||||
* <p>
|
||||
* This working copy manager does not assume the ownership of this working copy, i.e.,
|
||||
* the given working copy is not automatically be freed when this manager is shut down.
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue