mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
2004-12-22 Alain Magloire
On going work to clean cdt.ui from misc. warnings and removing the deprecated interfaces in Eclipse-3.1
This commit is contained in:
parent
c227d55fc4
commit
aee9e0e44e
65 changed files with 426 additions and 464 deletions
|
@ -1,3 +1,8 @@
|
|||
2004-12-22 Alain Magloire
|
||||
|
||||
On going work to clean cdt.ui from misc. warnings
|
||||
and removing the deprecated interfaces in Eclipse-3.1
|
||||
|
||||
2004-12-21 Alain Magloire
|
||||
We use TogglePresentation action definition ID rather the one
|
||||
define in the CDT, since now the platfrom defines one.
|
||||
|
|
|
@ -42,6 +42,11 @@ public final class Assert {
|
|||
*/
|
||||
private static class AssertionFailedException extends RuntimeException {
|
||||
|
||||
/**
|
||||
* Comment for <code>serialVersionUID</code>
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Constructs a new exception.
|
||||
*/
|
||||
|
|
|
@ -64,9 +64,8 @@ public class GroupDescription {
|
|||
int size= fEdits.size();
|
||||
if (size == 1) {
|
||||
return ((TextEdit)fEdits.get(0)).getRegion();
|
||||
} else {
|
||||
return TextEdit.getCoverage((TextEdit[])fEdits.toArray(new TextEdit[fEdits.size()]));
|
||||
}
|
||||
return TextEdit.getCoverage((TextEdit[])fEdits.toArray(new TextEdit[fEdits.size()]));
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
|
|
|
@ -122,9 +122,8 @@ import org.eclipse.ui.texteditor.IDocumentProvider;
|
|||
IDocument document= fDocumentProvider.getDocument(input);
|
||||
if (document != null) {
|
||||
return new TextBuffer(new Document(document.get()));
|
||||
} else {
|
||||
return createFromFile(file);
|
||||
}
|
||||
return createFromFile(file);
|
||||
}
|
||||
|
||||
private TextBuffer createFromFile(IFile file) throws CoreException {
|
||||
|
|
|
@ -23,10 +23,6 @@ import org.eclipse.jface.text.BadPositionCategoryException;
|
|||
import org.eclipse.jface.text.DefaultPositionUpdater;
|
||||
import org.eclipse.jface.text.Document;
|
||||
import org.eclipse.jface.text.Position;
|
||||
import org.eclipse.text.edits.DeleteEdit;
|
||||
import org.eclipse.text.edits.InsertEdit;
|
||||
import org.eclipse.text.edits.MultiTextEdit;
|
||||
import org.eclipse.text.edits.ReplaceEdit;
|
||||
import org.eclipse.text.edits.TextEdit;
|
||||
|
||||
public class CodeFormatterUtil {
|
||||
|
@ -82,31 +78,31 @@ public class CodeFormatterUtil {
|
|||
}
|
||||
|
||||
|
||||
private static TextEdit shifEdit(TextEdit oldEdit, int diff) {
|
||||
TextEdit newEdit;
|
||||
if (oldEdit instanceof ReplaceEdit) {
|
||||
ReplaceEdit edit= (ReplaceEdit) oldEdit;
|
||||
newEdit= new ReplaceEdit(edit.getOffset() - diff, edit.getLength(), edit.getText());
|
||||
} else if (oldEdit instanceof InsertEdit) {
|
||||
InsertEdit edit= (InsertEdit) oldEdit;
|
||||
newEdit= new InsertEdit(edit.getOffset() - diff, edit.getText());
|
||||
} else if (oldEdit instanceof DeleteEdit) {
|
||||
DeleteEdit edit= (DeleteEdit) oldEdit;
|
||||
newEdit= new DeleteEdit(edit.getOffset() - diff, edit.getLength());
|
||||
} else if (oldEdit instanceof MultiTextEdit) {
|
||||
newEdit= new MultiTextEdit();
|
||||
} else {
|
||||
return null; // not supported
|
||||
}
|
||||
TextEdit[] children= oldEdit.getChildren();
|
||||
for (int i= 0; i < children.length; i++) {
|
||||
TextEdit shifted= shifEdit(children[i], diff);
|
||||
if (shifted != null) {
|
||||
newEdit.addChild(shifted);
|
||||
}
|
||||
}
|
||||
return newEdit;
|
||||
}
|
||||
// private static TextEdit shifEdit(TextEdit oldEdit, int diff) {
|
||||
// TextEdit newEdit;
|
||||
// if (oldEdit instanceof ReplaceEdit) {
|
||||
// ReplaceEdit edit= (ReplaceEdit) oldEdit;
|
||||
// newEdit= new ReplaceEdit(edit.getOffset() - diff, edit.getLength(), edit.getText());
|
||||
// } else if (oldEdit instanceof InsertEdit) {
|
||||
// InsertEdit edit= (InsertEdit) oldEdit;
|
||||
// newEdit= new InsertEdit(edit.getOffset() - diff, edit.getText());
|
||||
// } else if (oldEdit instanceof DeleteEdit) {
|
||||
// DeleteEdit edit= (DeleteEdit) oldEdit;
|
||||
// newEdit= new DeleteEdit(edit.getOffset() - diff, edit.getLength());
|
||||
// } else if (oldEdit instanceof MultiTextEdit) {
|
||||
// newEdit= new MultiTextEdit();
|
||||
// } else {
|
||||
// return null; // not supported
|
||||
// }
|
||||
// TextEdit[] children= oldEdit.getChildren();
|
||||
// for (int i= 0; i < children.length; i++) {
|
||||
// TextEdit shifted= shifEdit(children[i], diff);
|
||||
// if (shifted != null) {
|
||||
// newEdit.addChild(shifted);
|
||||
// }
|
||||
// }
|
||||
// return newEdit;
|
||||
// }
|
||||
|
||||
private static Document createDocument(String string, Position[] positions) throws IllegalArgumentException {
|
||||
Document doc= new Document(string);
|
||||
|
|
|
@ -127,9 +127,8 @@ public class BinaryPropertySource extends FilePropertySource implements IPropert
|
|||
} else if (name.equals(ICElementPropertyConstants.P_ELF_HAS_DEBUG)) {
|
||||
if (binary.hasDebug()) {
|
||||
return "true";//$NON-NLS-1$
|
||||
} else {
|
||||
return "false";//$NON-NLS-1$
|
||||
}
|
||||
return "false";//$NON-NLS-1$
|
||||
} else if (name.equals(ICElementPropertyConstants.P_ELF_NEEDED)) {
|
||||
String[] needed = binary.getNeededSharedLibs();
|
||||
String need = ""; //$NON-NLS-1$
|
||||
|
|
|
@ -52,14 +52,13 @@ public class CElementAdapterFactory implements IAdapterFactory {
|
|||
if (IPropertySource.class.equals(key)) {
|
||||
if (celem instanceof IBinary) {
|
||||
return new BinaryPropertySource((IBinary)celem);
|
||||
} else {
|
||||
res = celem.getResource();
|
||||
if (res != null) {
|
||||
if (res instanceof IFile) {
|
||||
return new FilePropertySource((IFile)res);
|
||||
}
|
||||
return new ResourcePropertySource(res);
|
||||
}
|
||||
res = celem.getResource();
|
||||
if (res != null) {
|
||||
if (res instanceof IFile) {
|
||||
return new FilePropertySource((IFile)res);
|
||||
}
|
||||
return new ResourcePropertySource(res);
|
||||
}
|
||||
return new CElementPropertySource(celem);
|
||||
} else if (IWorkspaceRoot.class.equals(key)) {
|
||||
|
|
|
@ -14,8 +14,6 @@ package org.eclipse.cdt.internal.ui;
|
|||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
|
@ -50,7 +48,7 @@ public class CHelpProviderManager {
|
|||
final private static String C_HELP_SETTINGS_FILE_NAME = "cHelpSettings.xml"; //$NON-NLS-1$
|
||||
final private static String ELEMENT_ROOT = "cHelpSettings"; //$NON-NLS-1$
|
||||
|
||||
private static Map fProjectHelpSettings = null;
|
||||
//private static Map fProjectHelpSettings = null;
|
||||
private static CHelpSettings fDefaultHelpSettings = null;
|
||||
|
||||
private static File fSettingsFile = null;
|
||||
|
@ -69,11 +67,11 @@ public class CHelpProviderManager {
|
|||
return fSettingsFile;
|
||||
}
|
||||
|
||||
private static Map getSettingsMap(){
|
||||
if(fProjectHelpSettings == null)
|
||||
fProjectHelpSettings = new HashMap();
|
||||
return fProjectHelpSettings;
|
||||
}
|
||||
// private static Map getSettingsMap(){
|
||||
// if(fProjectHelpSettings == null)
|
||||
// fProjectHelpSettings = new HashMap();
|
||||
// return fProjectHelpSettings;
|
||||
// }
|
||||
|
||||
private static CHelpSettings getDefaultHelpSettings(){
|
||||
if(fDefaultHelpSettings == null){
|
||||
|
|
|
@ -7,7 +7,7 @@ package org.eclipse.cdt.internal.ui;
|
|||
|
||||
import org.eclipse.cdt.internal.ui.wizards.CWizardRegistry;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
import org.eclipse.search.ui.SearchUI;
|
||||
import org.eclipse.search.ui.NewSearchUI;
|
||||
import org.eclipse.ui.IFolderLayout;
|
||||
import org.eclipse.ui.IPageLayout;
|
||||
import org.eclipse.ui.IPerspectiveFactory;
|
||||
|
@ -48,7 +48,7 @@ public class CPerspectiveFactory implements IPerspectiveFactory {
|
|||
layout.addShowViewShortcut(IConsoleConstants.ID_CONSOLE_VIEW);
|
||||
|
||||
// views - searching
|
||||
layout.addShowViewShortcut(SearchUI.SEARCH_RESULT_VIEW_ID);
|
||||
layout.addShowViewShortcut(NewSearchUI.SEARCH_VIEW_ID);
|
||||
|
||||
// views - standard workbench
|
||||
layout.addShowViewShortcut(IPageLayout.ID_OUTLINE);
|
||||
|
|
|
@ -16,6 +16,11 @@ import org.eclipse.core.runtime.IStatus;
|
|||
|
||||
public class CUIException extends CoreException {
|
||||
|
||||
/**
|
||||
* Comment for <code>serialVersionUID</code>
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public CUIException(IStatus status) {
|
||||
super(status);
|
||||
}
|
||||
|
|
|
@ -78,9 +78,8 @@ public class DeferredCWorkbenchAdapter extends CWorkbenchAdapter
|
|||
if (fSerializeFetching) {
|
||||
// only one ICElement parent can fetch children at a time
|
||||
return mutexRule;
|
||||
} else {
|
||||
// allow several ICElement parents to fetch children concurrently
|
||||
return null;
|
||||
}
|
||||
}
|
||||
// allow several ICElement parents to fetch children concurrently
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -150,8 +150,7 @@ public class SelectionConverter {
|
|||
ICElement ref = tunit.getElementAtOffset(selection.getOffset());
|
||||
if (ref == null)
|
||||
return input;
|
||||
else
|
||||
return ref;
|
||||
return ref;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -169,8 +168,7 @@ public class SelectionConverter {
|
|||
ICElement[] refs = tunit.getElementsAtOffset(selection.getOffset());
|
||||
if (refs == null)
|
||||
return new ICElement[] { input };
|
||||
else
|
||||
return refs;
|
||||
return refs;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -80,9 +80,8 @@ public class WorkbenchRunnableAdapter implements IRunnableWithProgress {
|
|||
Throwable cause= e.getCause();
|
||||
if (cause instanceof CoreException) {
|
||||
return ((CoreException) cause).getStatus();
|
||||
} else {
|
||||
return CUIStatus.createError(IStatus.ERROR, cause);
|
||||
}
|
||||
return CUIStatus.createError(IStatus.ERROR, cause);
|
||||
} catch (InterruptedException e) {
|
||||
return Status.CANCEL_STATUS;
|
||||
} finally {
|
||||
|
|
|
@ -14,6 +14,7 @@ import java.util.Map;
|
|||
import org.eclipse.cdt.core.resources.IConsole;
|
||||
import org.eclipse.cdt.internal.ui.preferences.BuildConsolePreferencePage;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
import org.eclipse.cdt.ui.IBuildConsoleEvent;
|
||||
import org.eclipse.cdt.ui.IBuildConsoleListener;
|
||||
import org.eclipse.cdt.ui.IBuildConsoleManager;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
|
@ -47,8 +48,8 @@ public class BuildConsoleManager implements IBuildConsoleManager, IResourceChang
|
|||
ListenerList listeners = new ListenerList(1);
|
||||
BuildConsole fConsole;
|
||||
private Map fConsoleMap = new HashMap();
|
||||
private Color infoColor, outputColor, errorColor;
|
||||
private BuildConsoleStream infoStream, outputStream, errorStream;
|
||||
Color infoColor, outputColor, errorColor;
|
||||
BuildConsoleStream infoStream, outputStream, errorStream;
|
||||
|
||||
static public final int BUILD_STREAM_TYPE_INFO = 0;
|
||||
static public final int BUILD_STREAM_TYPE_OUTPUT = 1;
|
||||
|
@ -68,7 +69,7 @@ public class BuildConsoleManager implements IBuildConsoleManager, IResourceChang
|
|||
if (list.length > 0) {
|
||||
for (int i = 0; i < list.length; i++) {
|
||||
IBuildConsoleListener listener = (IBuildConsoleListener)list[i];
|
||||
ConsoleEvent event = new ConsoleEvent(BuildConsoleManager.this, project, ConsoleEvent.CONSOLE_START);
|
||||
ConsoleEvent event = new ConsoleEvent(BuildConsoleManager.this, project, IBuildConsoleEvent.CONSOLE_START);
|
||||
listener.consoleChange(event);
|
||||
}
|
||||
}
|
||||
|
@ -134,7 +135,7 @@ public class BuildConsoleManager implements IBuildConsoleManager, IResourceChang
|
|||
if (list.length > 0) {
|
||||
for (int i = 0; i < list.length; i++) {
|
||||
IBuildConsoleListener listener = (IBuildConsoleListener)list[i];
|
||||
ConsoleEvent consoleEvent = new ConsoleEvent(this, (IProject)resource, ConsoleEvent.CONSOLE_CLOSE);
|
||||
ConsoleEvent consoleEvent = new ConsoleEvent(this, (IProject)resource, IBuildConsoleEvent.CONSOLE_CLOSE);
|
||||
listener.consoleChange(consoleEvent);
|
||||
}
|
||||
}
|
||||
|
@ -237,7 +238,7 @@ public class BuildConsoleManager implements IBuildConsoleManager, IResourceChang
|
|||
/**
|
||||
* Returns a color instance based on data from a preference field.
|
||||
*/
|
||||
private Color createColor(Display display, String preference) {
|
||||
Color createColor(Display display, String preference) {
|
||||
RGB rgb = PreferenceConverter.getColor(CUIPlugin.getDefault().getPreferenceStore(), preference);
|
||||
return new Color(display, rgb);
|
||||
}
|
||||
|
|
|
@ -62,9 +62,9 @@ public class BuildConsolePartitioner
|
|||
* Intentionally a vector to obtain synchronization as entries are added and
|
||||
* removed.
|
||||
*/
|
||||
private Vector fQueue = new Vector(5);
|
||||
Vector fQueue = new Vector(5);
|
||||
|
||||
private boolean fAppending;
|
||||
//private boolean fAppending;
|
||||
|
||||
class StreamEntry {
|
||||
|
||||
|
@ -167,7 +167,7 @@ public class BuildConsolePartitioner
|
|||
}
|
||||
}
|
||||
|
||||
private void warnOfContentChange(BuildConsoleStream stream) {
|
||||
void warnOfContentChange(BuildConsoleStream stream) {
|
||||
if (stream != null) {
|
||||
ConsolePlugin.getDefault().getConsoleManager().warnOfContentChange(stream.getConsole());
|
||||
}
|
||||
|
|
|
@ -17,6 +17,11 @@ import org.eclipse.core.resources.IProject;
|
|||
|
||||
public class ConsoleEvent extends EventObject implements IBuildConsoleEvent {
|
||||
|
||||
/**
|
||||
* Comment for <code>serialVersionUID</code>
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private IProject fProject;
|
||||
private int fType;
|
||||
|
||||
|
|
|
@ -40,7 +40,12 @@ public class CParseTreeBuilder extends SourceElementRequestorAdapter {
|
|||
/**
|
||||
* Syntax Error.
|
||||
*/
|
||||
public class ParseError extends Error {
|
||||
public class ParseError extends Error {
|
||||
|
||||
/**
|
||||
* Comment for <code>serialVersionUID</code>
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
||||
public CParseTreeBuilder(CNode root, IDocument doc) {
|
||||
|
|
|
@ -53,6 +53,7 @@ import org.eclipse.jface.action.MenuManager;
|
|||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.jface.util.IPropertyChangeListener;
|
||||
import org.eclipse.jface.util.PropertyChangeEvent;
|
||||
import org.eclipse.jface.viewers.AbstractTreeViewer;
|
||||
import org.eclipse.jface.viewers.DoubleClickEvent;
|
||||
import org.eclipse.jface.viewers.IContentProvider;
|
||||
import org.eclipse.jface.viewers.IDoubleClickListener;
|
||||
|
@ -884,7 +885,7 @@ public class CView extends ViewPart implements ISetSelectionTarget, IPropertyCha
|
|||
|
||||
public void collapseAll() {
|
||||
viewer.getControl().setRedraw(false);
|
||||
viewer.collapseToLevel(getViewPartInput(), TreeViewer.ALL_LEVELS);
|
||||
viewer.collapseToLevel(getViewPartInput(), AbstractTreeViewer.ALL_LEVELS);
|
||||
viewer.getControl().setRedraw(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ import org.eclipse.cdt.ui.CUIPlugin;
|
|||
import org.eclipse.core.resources.IContainer;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.ResourceAttributes;
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.MultiStatus;
|
||||
|
@ -139,11 +140,11 @@ class CViewDropAdapter extends PluginDropAdapter implements IOverwriteQuery {
|
|||
IResource tempResourceParent = tempResource.getParent();
|
||||
//Apples to apples...
|
||||
IResource resourceCurrentContainer = currentContainer.getResource();
|
||||
|
||||
ResourceAttributes attributes = tempResource.getResourceAttributes();
|
||||
if (tempResourceParent.equals(resourceCurrentContainer) ||
|
||||
tempResource.equals(resourceCurrentContainer) ||
|
||||
tempResource.equals(resourceCurrentContainer.getParent()) ||
|
||||
tempResource.isReadOnly()){
|
||||
attributes.isReadOnly()){
|
||||
event.detail = DND.DROP_NONE;
|
||||
break;
|
||||
}
|
||||
|
@ -303,8 +304,8 @@ class CViewDropAdapter extends PluginDropAdapter implements IOverwriteQuery {
|
|||
IStructuredSelection structuredSelection = (IStructuredSelection) selection;
|
||||
|
||||
// loop through list and look for matching items
|
||||
for (Iterator enum = structuredSelection.iterator(); enum.hasNext();) {
|
||||
Object object = enum.next();
|
||||
for (Iterator enumarator = structuredSelection.iterator(); enumarator.hasNext();) {
|
||||
Object object = enumarator.next();
|
||||
IResource resource = null;
|
||||
|
||||
if (object instanceof IResource) {
|
||||
|
|
|
@ -168,7 +168,7 @@ public class MainActionGroup extends CViewActionGroup {
|
|||
IStructuredSelection resources = SelectionConverter.convertSelectionToResources(celements);
|
||||
|
||||
if (resources.isEmpty()) {
|
||||
new NewWizardMenu(menu, getCView().getSite().getWorkbenchWindow(), false);
|
||||
new NewWizardMenu(getCView().getSite().getWorkbenchWindow());
|
||||
menu.add(new Separator(IContextMenuConstants.GROUP_REORGANIZE));
|
||||
refactoringActionGroup.fillContextMenu(menu);
|
||||
menu.add(new Separator());
|
||||
|
@ -223,7 +223,7 @@ public class MainActionGroup extends CViewActionGroup {
|
|||
|
||||
void addNewMenu(IMenuManager menu, IStructuredSelection selection) {
|
||||
MenuManager newMenu = new MenuManager(CViewMessages.getString("NewWizardsActionGroup.new")); //$NON-NLS-1$
|
||||
new NewWizardMenu(newMenu, getCView().getSite().getWorkbenchWindow(), false);
|
||||
new NewWizardMenu(getCView().getSite().getWorkbenchWindow());
|
||||
menu.add(newMenu);
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ public class PasteAction extends SelectionListenerAction {
|
|||
/**
|
||||
* System clipboard
|
||||
*/
|
||||
private Clipboard clipboard;
|
||||
Clipboard clipboard;
|
||||
|
||||
/**
|
||||
* Creates a new action.
|
||||
|
@ -153,8 +153,7 @@ public class PasteAction extends SelectionListenerAction {
|
|||
List selection = getSelectedResources();
|
||||
if (selection.get(0) instanceof IFile)
|
||||
return ((IFile) selection.get(0)).getParent();
|
||||
else
|
||||
return (IContainer) selection.get(0);
|
||||
return (IContainer) selection.get(0);
|
||||
}
|
||||
/**
|
||||
* The <code>PasteAction</code> implementation of this
|
||||
|
|
|
@ -48,9 +48,8 @@ public class StatusTool {
|
|||
public static IStatus getMoreSevere(IStatus s1, IStatus s2) {
|
||||
if (s1.getSeverity() > s2.getSeverity()) {
|
||||
return s1;
|
||||
} else {
|
||||
return s2;
|
||||
}
|
||||
return s2;
|
||||
}
|
||||
/**
|
||||
* Finds the most severe status from a array of status
|
||||
|
|
|
@ -7,6 +7,7 @@ package org.eclipse.cdt.internal.ui.dialogs;
|
|||
import org.eclipse.core.runtime.IStatus;
|
||||
|
||||
import org.eclipse.jface.dialogs.DialogPage;
|
||||
import org.eclipse.jface.dialogs.IMessageProvider;
|
||||
|
||||
/**
|
||||
* A utility class to work with IStatus.
|
||||
|
@ -21,9 +22,8 @@ public class StatusUtil {
|
|||
public static IStatus getMoreSevere(IStatus s1, IStatus s2) {
|
||||
if (s1.getSeverity() > s2.getSeverity()) {
|
||||
return s1;
|
||||
} else {
|
||||
return s2;
|
||||
}
|
||||
return s2;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -52,15 +52,15 @@ public class StatusUtil {
|
|||
String message= status.getMessage();
|
||||
switch (status.getSeverity()) {
|
||||
case IStatus.OK:
|
||||
page.setMessage(message, DialogPage.NONE);
|
||||
page.setMessage(message, IMessageProvider.NONE);
|
||||
page.setErrorMessage(null);
|
||||
break;
|
||||
case IStatus.WARNING:
|
||||
page.setMessage(message, DialogPage.WARNING);
|
||||
page.setMessage(message, IMessageProvider.WARNING);
|
||||
page.setErrorMessage(null);
|
||||
break;
|
||||
case IStatus.INFO:
|
||||
page.setMessage(message, DialogPage.INFORMATION);
|
||||
page.setMessage(message, IMessageProvider.INFORMATION);
|
||||
page.setErrorMessage(null);
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -22,7 +22,6 @@ import org.eclipse.cdt.core.model.IElementChangedListener;
|
|||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||
import org.eclipse.cdt.internal.ui.BaseCElementContentProvider;
|
||||
import org.eclipse.cdt.internal.ui.util.StringMatcher;
|
||||
import org.eclipse.cdt.ui.IncludesGrouping;
|
||||
import org.eclipse.cdt.ui.PreferenceConstants;
|
||||
import org.eclipse.jface.util.IPropertyChangeListener;
|
||||
import org.eclipse.jface.util.PropertyChangeEvent;
|
||||
|
|
|
@ -333,15 +333,12 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IS
|
|||
}
|
||||
|
||||
if (PreferenceConstants.EDITOR_FOLDING_PROVIDER.equals(property)) {
|
||||
if (asv instanceof ProjectionViewer) {
|
||||
ProjectionViewer projectionViewer= (ProjectionViewer) asv;
|
||||
if (fProjectionModelUpdater != null)
|
||||
fProjectionModelUpdater.uninstall();
|
||||
// either freshly enabled or provider changed
|
||||
fProjectionModelUpdater= CUIPlugin.getDefault().getFoldingStructureProviderRegistry().getCurrentFoldingProvider();
|
||||
if (fProjectionModelUpdater != null) {
|
||||
fProjectionModelUpdater.install(this, projectionViewer);
|
||||
}
|
||||
if (fProjectionModelUpdater != null)
|
||||
fProjectionModelUpdater.uninstall();
|
||||
// either freshly enabled or provider changed
|
||||
fProjectionModelUpdater= CUIPlugin.getDefault().getFoldingStructureProviderRegistry().getCurrentFoldingProvider();
|
||||
if (fProjectionModelUpdater != null) {
|
||||
fProjectionModelUpdater.install(this, asv);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ import org.eclipse.core.filebuffers.ITextFileBuffer;
|
|||
import org.eclipse.core.filebuffers.ITextFileBufferManager;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.ResourceAttributes;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
|
@ -361,7 +362,11 @@ public class DocumentAdapter implements IBuffer, IDocumentListener {
|
|||
*/
|
||||
public boolean isReadOnly() {
|
||||
IResource resource= getUnderlyingResource();
|
||||
return resource == null ? true : resource.isReadOnly();
|
||||
if (resource != null) {
|
||||
ResourceAttributes attributes = resource.getResourceAttributes();
|
||||
return attributes.isReadOnly();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -420,63 +420,60 @@ IPropertyChangeListener{
|
|||
//Allow for new lines
|
||||
if (start == end)
|
||||
return new Region(start, 0);
|
||||
else{
|
||||
String selWord = null;
|
||||
String slas = document.get(start,1);
|
||||
if (slas.equals("\n") || //$NON-NLS-1$
|
||||
|
||||
String selWord = null;
|
||||
String slas = document.get(start,1);
|
||||
if (slas.equals("\n") || //$NON-NLS-1$
|
||||
slas.equals("\t") || //$NON-NLS-1$
|
||||
slas.equals(" ")) //$NON-NLS-1$
|
||||
{
|
||||
|
||||
selWord =document.get(start+1, end - start - 1);
|
||||
}
|
||||
else{
|
||||
selWord =document.get(start, end - start);
|
||||
}
|
||||
//Check for keyword
|
||||
if (isKeyWord(selWord))
|
||||
return null;
|
||||
//Avoid selecting literals, includes etc.
|
||||
char charX = selWord.charAt(0);
|
||||
if (charX == '"' ||
|
||||
slas.equals(" ")) //$NON-NLS-1$
|
||||
{
|
||||
|
||||
selWord =document.get(start+1, end - start - 1);
|
||||
}
|
||||
else{
|
||||
selWord =document.get(start, end - start);
|
||||
}
|
||||
//Check for keyword
|
||||
if (isKeyWord(selWord))
|
||||
return null;
|
||||
//Avoid selecting literals, includes etc.
|
||||
char charX = selWord.charAt(0);
|
||||
if (charX == '"' ||
|
||||
charX == '.' ||
|
||||
charX == '<' ||
|
||||
charX == '>')
|
||||
return null;
|
||||
return null;
|
||||
|
||||
if (selWord.equals("#include")) //$NON-NLS-1$
|
||||
{
|
||||
//get start of next identifier
|
||||
|
||||
if (selWord.equals("#include")) //$NON-NLS-1$
|
||||
{
|
||||
//get start of next identifier
|
||||
|
||||
int end2 = end;
|
||||
|
||||
while (!Character.isJavaIdentifierPart(document.getChar(end2))){
|
||||
++end2;
|
||||
|
||||
|
||||
int end2 = end;
|
||||
|
||||
while (!Character.isJavaIdentifierPart(document.getChar(end2))){
|
||||
++end2;
|
||||
|
||||
}
|
||||
|
||||
while (end2 < length){
|
||||
c = document.getChar(end2);
|
||||
|
||||
if (!Character.isJavaIdentifierPart(c) &&
|
||||
c != '.')
|
||||
break;
|
||||
++end2;
|
||||
}
|
||||
|
||||
int finalEnd = end2;
|
||||
selWord =document.get(start, finalEnd - start);
|
||||
end = finalEnd + 1;
|
||||
start--;
|
||||
fIncludeMode = true;
|
||||
}
|
||||
|
||||
|
||||
while (end2 < length){
|
||||
c = document.getChar(end2);
|
||||
|
||||
if (!Character.isJavaIdentifierPart(c) &&
|
||||
c != '.')
|
||||
break;
|
||||
++end2;
|
||||
}
|
||||
|
||||
return new Region(start + 1, end - start - 1);
|
||||
int finalEnd = end2;
|
||||
selWord =document.get(start, finalEnd - start);
|
||||
end = finalEnd + 1;
|
||||
start--;
|
||||
fIncludeMode = true;
|
||||
}
|
||||
|
||||
return new Region(start + 1, end - start - 1);
|
||||
|
||||
} catch (BadLocationException x) {
|
||||
return null;
|
||||
}
|
||||
|
@ -509,9 +506,8 @@ IPropertyChangeListener{
|
|||
if (viewer instanceof ITextViewerExtension5) {
|
||||
ITextViewerExtension5 extension= (ITextViewerExtension5) viewer;
|
||||
return extension.widgetOffset2ModelOffset(widgetOffset);
|
||||
} else {
|
||||
return widgetOffset + viewer.getVisibleRegion().getOffset();
|
||||
}
|
||||
return widgetOffset + viewer.getVisibleRegion().getOffset();
|
||||
|
||||
} catch (IllegalArgumentException e) {
|
||||
return -1;
|
||||
|
|
|
@ -109,12 +109,11 @@ public final class AsmCodeScanner extends AbstractCScanner {
|
|||
if(c != ':') {
|
||||
unreadBuffer(scanner);
|
||||
return fDefaultToken;
|
||||
} else {
|
||||
fBuffer.append((char) c);
|
||||
IToken token= (IToken) fWords.get(":"); //$NON-NLS-1$
|
||||
if (token != null)
|
||||
return token;
|
||||
}
|
||||
fBuffer.append((char) c);
|
||||
IToken token= (IToken) fWords.get(":"); //$NON-NLS-1$
|
||||
if (token != null)
|
||||
return token;
|
||||
|
||||
return fDefaultToken;
|
||||
}
|
||||
|
|
|
@ -8,8 +8,8 @@ package org.eclipse.cdt.internal.ui.editor.asm;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.text.CPartitionScanner;
|
||||
import org.eclipse.cdt.internal.ui.text.ICColorConstants;
|
||||
import org.eclipse.cdt.internal.ui.text.ICPartitions;
|
||||
import org.eclipse.jface.text.rules.EndOfLineRule;
|
||||
import org.eclipse.jface.text.rules.ICharacterScanner;
|
||||
import org.eclipse.jface.text.rules.IPredicateRule;
|
||||
|
@ -95,9 +95,9 @@ public class AsmPartitionScanner extends RuleBasedPartitionScanner {
|
|||
public AsmPartitionScanner() {
|
||||
super();
|
||||
|
||||
IToken comment= new Token(CPartitionScanner.C_MULTILINE_COMMENT);
|
||||
IToken single_comment= new Token(CPartitionScanner.C_SINGLE_LINE_COMMENT);
|
||||
IToken string= new Token(CPartitionScanner.C_STRING);
|
||||
IToken comment= new Token(ICPartitions.C_MULTILINE_COMMENT);
|
||||
IToken single_comment= new Token(ICPartitions.C_SINGLE_LINE_COMMENT);
|
||||
IToken string= new Token(ICPartitions.C_STRING);
|
||||
// IToken skip= new Token(SKIP);
|
||||
|
||||
|
||||
|
|
|
@ -40,9 +40,8 @@ public class AsmWordDetector implements IWordDetector {
|
|||
}
|
||||
if(fStrictStart) {
|
||||
return (Character.isJavaIdentifierStart(c) || (c == fExtra));
|
||||
} else {
|
||||
return (Character.isJavaIdentifierPart(c) || (c == fExtra));
|
||||
}
|
||||
return (Character.isJavaIdentifierPart(c) || (c == fExtra));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -125,9 +125,8 @@ public abstract class OptionsConfigurationBlock {
|
|||
protected Map getOptions(boolean inheritCCoreOptions) {
|
||||
if (fProject != null) {
|
||||
return fProject.getOptions(inheritCCoreOptions);
|
||||
} else {
|
||||
return CCorePlugin.getOptions();
|
||||
}
|
||||
}
|
||||
return CCorePlugin.getOptions();
|
||||
}
|
||||
|
||||
protected Map getDefaultOptions() {
|
||||
|
|
|
@ -86,16 +86,15 @@ public class TodoTaskConfigurationBlock extends OptionsConfigurationBlock {
|
|||
TodoTask task= (TodoTask) element;
|
||||
if (columnIndex == 0) {
|
||||
return task.name;
|
||||
} else {
|
||||
if (PRIORITY_HIGH.equals(task.priority)) {
|
||||
return PreferencesMessages.getString("TodoTaskConfigurationBlock.markers.tasks.high.priority"); //$NON-NLS-1$
|
||||
} else if (PRIORITY_NORMAL.equals(task.priority)) {
|
||||
return PreferencesMessages.getString("TodoTaskConfigurationBlock.markers.tasks.normal.priority"); //$NON-NLS-1$
|
||||
} else if (PRIORITY_LOW.equals(task.priority)) {
|
||||
return PreferencesMessages.getString("TodoTaskConfigurationBlock.markers.tasks.low.priority"); //$NON-NLS-1$
|
||||
}
|
||||
return ""; //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
if (PRIORITY_HIGH.equals(task.priority)) {
|
||||
return PreferencesMessages.getString("TodoTaskConfigurationBlock.markers.tasks.high.priority"); //$NON-NLS-1$
|
||||
} else if (PRIORITY_NORMAL.equals(task.priority)) {
|
||||
return PreferencesMessages.getString("TodoTaskConfigurationBlock.markers.tasks.normal.priority"); //$NON-NLS-1$
|
||||
} else if (PRIORITY_LOW.equals(task.priority)) {
|
||||
return PreferencesMessages.getString("TodoTaskConfigurationBlock.markers.tasks.low.priority"); //$NON-NLS-1$
|
||||
}
|
||||
return ""; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -207,8 +207,7 @@ public abstract class AbstractCScanner extends BufferedRuleBasedScanner {
|
|||
}
|
||||
if (read() == EOF)
|
||||
return Token.EOF;
|
||||
else
|
||||
return fDefaultToken;
|
||||
return fDefaultToken;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -105,10 +105,8 @@ public final class BufferedDocumentScanner implements ICharacterScanner {
|
|||
if (fOffset >= fBufferLength) {
|
||||
if (fBufferOffset + fBufferLength >= fRangeOffset + fRangeLength)
|
||||
return EOF;
|
||||
else {
|
||||
updateBuffer(fBufferOffset + fBufferLength);
|
||||
fOffset= 0;
|
||||
}
|
||||
updateBuffer(fBufferOffset + fBufferLength);
|
||||
fOffset= 0;
|
||||
}
|
||||
|
||||
return fBuffer[fOffset++];
|
||||
|
|
|
@ -87,14 +87,12 @@ public class CDoubleClickSelector implements ITextDoubleClickStrategy {
|
|||
fEndPos= searchForClosingBracket(fStartPos, prevChar, fgBrackets[bracketIndex1 + 1], doc);
|
||||
if (fEndPos > -1)
|
||||
return true;
|
||||
else
|
||||
fStartPos= -1;
|
||||
fStartPos= -1;
|
||||
} else if (fEndPos > -1) {
|
||||
fStartPos= searchForOpenBracket(fEndPos, fgBrackets[bracketIndex2 - 1], nextChar, doc);
|
||||
if (fStartPos > -1)
|
||||
return true;
|
||||
else
|
||||
fEndPos= -1;
|
||||
fEndPos= -1;
|
||||
}
|
||||
} catch (BadLocationException x) {
|
||||
}
|
||||
|
@ -161,8 +159,7 @@ public class CDoubleClickSelector implements ITextDoubleClickStrategy {
|
|||
|
||||
if (stack == 0)
|
||||
return closePos - 1;
|
||||
else
|
||||
return -1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -183,8 +180,7 @@ public class CDoubleClickSelector implements ITextDoubleClickStrategy {
|
|||
|
||||
if (stack == 0)
|
||||
return openPos + 1;
|
||||
else
|
||||
return -1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* COutlineInformationControl.java 2004-12-14 / 08:17:41
|
||||
|
||||
* $Revision:$ $Date:$
|
||||
* $Revision: 1.1 $ $Date: 2004/12/14 18:46:19 $
|
||||
*
|
||||
* @author P.Tomaszewski
|
||||
*/
|
||||
|
@ -83,37 +83,37 @@ public class COutlineInformationControl implements IInformationControl,
|
|||
private static final int MIN_WIDTH = 300;
|
||||
|
||||
/** Source viewer which shows this control. */
|
||||
private CEditor fEditor;
|
||||
CEditor fEditor;
|
||||
|
||||
/** Shell for this control. */
|
||||
private Shell fShell;
|
||||
Shell fShell;
|
||||
|
||||
/** Control's composite. */
|
||||
private Composite fComposite;
|
||||
Composite fComposite;
|
||||
|
||||
/** Tree viewer used to display outline. */
|
||||
private TreeViewer fTreeViewer;
|
||||
TreeViewer fTreeViewer;
|
||||
|
||||
/** Text control for filter. */
|
||||
private Text fFilterText;
|
||||
|
||||
/** Content provider for tree control. */
|
||||
private IContentProvider fTreeContentProvider;
|
||||
IContentProvider fTreeContentProvider;
|
||||
|
||||
/** Sorter for tree viewer. */
|
||||
private OutlineSorter fSorter;
|
||||
|
||||
/** Control bounds. */
|
||||
private Rectangle fBounds;
|
||||
Rectangle fBounds;
|
||||
|
||||
/** Control trim. */
|
||||
private Rectangle fTrim;
|
||||
Rectangle fTrim;
|
||||
|
||||
/** Deactivation adapter. */
|
||||
private Listener fDeactivateListener;
|
||||
|
||||
/** This prevents to notify listener when it is adding. */
|
||||
private boolean fIsDeactivationActive;
|
||||
boolean fIsDeactivationActive;
|
||||
|
||||
/** Shell adapter, used for control deactivation. */
|
||||
private ShellListener fShellListener;
|
||||
|
@ -122,7 +122,7 @@ public class COutlineInformationControl implements IInformationControl,
|
|||
private ControlListener fControlListener;
|
||||
|
||||
/** Should outline be sorted. */
|
||||
private boolean fSort = true;
|
||||
boolean fSort = true;
|
||||
|
||||
/**
|
||||
* Creates new outline control.
|
||||
|
|
|
@ -114,15 +114,13 @@ public class CPairMatcher implements ICharacterPairMatcher {
|
|||
fStartPos= searchForOpeningPeer(fEndPos, fPairs[pairIndex2 - 1], fPairs[pairIndex2], fDocument);
|
||||
if (fStartPos > -1)
|
||||
return true;
|
||||
else
|
||||
fEndPos= -1;
|
||||
fEndPos= -1;
|
||||
} else if (fStartPos > -1) {
|
||||
fAnchor= LEFT;
|
||||
fEndPos= searchForClosingPeer(fStartPos, fPairs[pairIndex1], fPairs[pairIndex1 + 1], fDocument);
|
||||
if (fEndPos > -1)
|
||||
return true;
|
||||
else
|
||||
fStartPos= -1;
|
||||
fStartPos= -1;
|
||||
}
|
||||
|
||||
} catch (BadLocationException x) {
|
||||
|
|
|
@ -160,16 +160,16 @@ public class CSourceViewerConfiguration extends SourceViewerConfiguration {
|
|||
//TextAttribute attr = new TextAttribute(manager.getColor(ICColorConstants.C_DEFAULT));
|
||||
|
||||
dr= new DefaultDamagerRepairer(getSinglelineCommentScanner());
|
||||
reconciler.setDamager(dr, CPartitionScanner.C_SINGLE_LINE_COMMENT);
|
||||
reconciler.setRepairer(dr, CPartitionScanner.C_SINGLE_LINE_COMMENT);
|
||||
reconciler.setDamager(dr, ICPartitions.C_SINGLE_LINE_COMMENT);
|
||||
reconciler.setRepairer(dr, ICPartitions.C_SINGLE_LINE_COMMENT);
|
||||
|
||||
dr= new DefaultDamagerRepairer(getStringScanner());
|
||||
reconciler.setDamager(dr, CPartitionScanner.C_STRING);
|
||||
reconciler.setRepairer(dr, CPartitionScanner.C_STRING);
|
||||
reconciler.setDamager(dr, ICPartitions.C_STRING);
|
||||
reconciler.setRepairer(dr, ICPartitions.C_STRING);
|
||||
|
||||
dr= new DefaultDamagerRepairer(getMultilineCommentScanner());
|
||||
reconciler.setDamager(dr, CPartitionScanner.C_MULTILINE_COMMENT);
|
||||
reconciler.setRepairer(dr, CPartitionScanner.C_MULTILINE_COMMENT);
|
||||
reconciler.setDamager(dr, ICPartitions.C_MULTILINE_COMMENT);
|
||||
reconciler.setRepairer(dr, ICPartitions.C_MULTILINE_COMMENT);
|
||||
|
||||
return reconciler;
|
||||
}
|
||||
|
@ -192,7 +192,7 @@ public class CSourceViewerConfiguration extends SourceViewerConfiguration {
|
|||
ContentAssistPreference.configure(assistant, getPreferenceStore());
|
||||
|
||||
assistant.setProposalPopupOrientation(IContentAssistant.PROPOSAL_OVERLAY);
|
||||
assistant.setContextInformationPopupOrientation(ContentAssistant.CONTEXT_INFO_ABOVE);
|
||||
assistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);
|
||||
assistant.setInformationControlCreator(getInformationControlCreator(sourceViewer));
|
||||
|
||||
return assistant;
|
||||
|
@ -226,8 +226,9 @@ public class CSourceViewerConfiguration extends SourceViewerConfiguration {
|
|||
* @see SourceViewerConfiguration#getAutoIndentStrategy(ISourceViewer, String)
|
||||
*/
|
||||
public IAutoIndentStrategy getAutoIndentStrategy(ISourceViewer sourceViewer, String contentType) {
|
||||
if(CPartitionScanner.C_MULTILINE_COMMENT.equals(contentType))
|
||||
if(ICPartitions.C_MULTILINE_COMMENT.equals(contentType)) {
|
||||
return new CCommentAutoIndentStrategy();
|
||||
}
|
||||
return new CAutoIndentStrategy();
|
||||
}
|
||||
|
||||
|
@ -252,10 +253,12 @@ public class CSourceViewerConfiguration extends SourceViewerConfiguration {
|
|||
public String getDefaultPrefix(ISourceViewer sourceViewer, String contentType) {
|
||||
if(IDocument.DEFAULT_CONTENT_TYPE.equals(contentType))
|
||||
return "//"; //$NON-NLS-1$
|
||||
if(CPartitionScanner.C_SINGLE_LINE_COMMENT.equals(contentType))
|
||||
if(ICPartitions.C_SINGLE_LINE_COMMENT.equals(contentType)) {
|
||||
return "//"; //$NON-NLS-1$
|
||||
if(CPartitionScanner.C_MULTILINE_COMMENT.equals(contentType))
|
||||
}
|
||||
if(ICPartitions.C_MULTILINE_COMMENT.equals(contentType)) {
|
||||
return "//"; //$NON-NLS-1$
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -371,9 +374,9 @@ public class CSourceViewerConfiguration extends SourceViewerConfiguration {
|
|||
*/
|
||||
public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
|
||||
return new String[] { IDocument.DEFAULT_CONTENT_TYPE,
|
||||
CPartitionScanner.C_MULTILINE_COMMENT,
|
||||
CPartitionScanner.C_SINGLE_LINE_COMMENT,
|
||||
CPartitionScanner.C_STRING };
|
||||
ICPartitions.C_MULTILINE_COMMENT,
|
||||
ICPartitions.C_SINGLE_LINE_COMMENT,
|
||||
ICPartitions.C_STRING };
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -73,10 +73,9 @@ public class FastCPartitionScanner implements IPartitionTokenScanner, ICPartitio
|
|||
if (fCOffset != -1 && fTokenOffset + fTokenLength != fCOffset + fCLength) {
|
||||
fTokenOffset += fTokenLength;
|
||||
return fTokens[CCODE];
|
||||
} else {
|
||||
fCOffset= -1;
|
||||
fCLength= 0;
|
||||
}
|
||||
fCOffset= -1;
|
||||
fCLength= 0;
|
||||
}
|
||||
|
||||
fTokenOffset += fTokenLength;
|
||||
|
@ -92,11 +91,10 @@ public class FastCPartitionScanner implements IPartitionTokenScanner, ICPartitio
|
|||
fLast= NONE; // ignore last
|
||||
return preFix(fState, CCODE, NONE, 0);
|
||||
|
||||
} else {
|
||||
fLast= NONE;
|
||||
fPrefixLength= 0;
|
||||
return Token.EOF;
|
||||
}
|
||||
fLast= NONE;
|
||||
fPrefixLength= 0;
|
||||
return Token.EOF;
|
||||
|
||||
case '\r':
|
||||
// emulate CPartitionScanner
|
||||
|
@ -105,38 +103,36 @@ public class FastCPartitionScanner implements IPartitionTokenScanner, ICPartitio
|
|||
fTokenLength++;
|
||||
continue;
|
||||
|
||||
} else {
|
||||
|
||||
switch (fState) {
|
||||
case SINGLE_LINE_COMMENT:
|
||||
case CHARACTER:
|
||||
case STRING:
|
||||
if (fTokenLength > 0) {
|
||||
IToken token= fTokens[fState];
|
||||
|
||||
// emulate CPartitionScanner
|
||||
if (fgEmulate) {
|
||||
fTokenLength++;
|
||||
fLast= NONE;
|
||||
fPrefixLength= 0;
|
||||
} else {
|
||||
fLast= CARRIAGE_RETURN;
|
||||
fPrefixLength= 1;
|
||||
}
|
||||
|
||||
fState= CCODE;
|
||||
return token;
|
||||
|
||||
} else {
|
||||
consume();
|
||||
continue;
|
||||
}
|
||||
|
||||
default:
|
||||
consume();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
switch (fState) {
|
||||
case SINGLE_LINE_COMMENT:
|
||||
case CHARACTER:
|
||||
case STRING:
|
||||
if (fTokenLength > 0) {
|
||||
IToken token= fTokens[fState];
|
||||
|
||||
// emulate CPartitionScanner
|
||||
if (fgEmulate) {
|
||||
fTokenLength++;
|
||||
fLast= NONE;
|
||||
fPrefixLength= 0;
|
||||
} else {
|
||||
fLast= CARRIAGE_RETURN;
|
||||
fPrefixLength= 1;
|
||||
}
|
||||
|
||||
fState= CCODE;
|
||||
return token;
|
||||
|
||||
}
|
||||
consume();
|
||||
continue;
|
||||
|
||||
default:
|
||||
consume();
|
||||
continue;
|
||||
}
|
||||
|
||||
case '\n':
|
||||
switch (fState) {
|
||||
|
@ -214,56 +210,48 @@ public class FastCPartitionScanner implements IPartitionTokenScanner, ICPartitio
|
|||
if (fLast == SLASH) {
|
||||
if (fTokenLength - getLastLength(fLast) > 0) {
|
||||
return preFix(CCODE, SINGLE_LINE_COMMENT, NONE, 2);
|
||||
} else {
|
||||
preFix(CCODE, SINGLE_LINE_COMMENT, NONE, 2);
|
||||
fTokenOffset += fTokenLength;
|
||||
fTokenLength= fPrefixLength;
|
||||
break;
|
||||
}
|
||||
|
||||
} else {
|
||||
fTokenLength++;
|
||||
fLast= SLASH;
|
||||
}
|
||||
preFix(CCODE, SINGLE_LINE_COMMENT, NONE, 2);
|
||||
fTokenOffset += fTokenLength;
|
||||
fTokenLength= fPrefixLength;
|
||||
break;
|
||||
|
||||
}
|
||||
fTokenLength++;
|
||||
fLast= SLASH;
|
||||
break;
|
||||
|
||||
case '*':
|
||||
if (fLast == SLASH) {
|
||||
if (fTokenLength - getLastLength(fLast) > 0)
|
||||
return preFix(CCODE, MULTI_LINE_COMMENT, SLASH_STAR, 2);
|
||||
else {
|
||||
preFix(CCODE, MULTI_LINE_COMMENT, SLASH_STAR, 2);
|
||||
fTokenOffset += fTokenLength;
|
||||
fTokenLength= fPrefixLength;
|
||||
break;
|
||||
}
|
||||
|
||||
} else {
|
||||
consume();
|
||||
|
||||
preFix(CCODE, MULTI_LINE_COMMENT, SLASH_STAR, 2);
|
||||
fTokenOffset += fTokenLength;
|
||||
fTokenLength= fPrefixLength;
|
||||
break;
|
||||
|
||||
}
|
||||
consume();
|
||||
break;
|
||||
|
||||
case '\'':
|
||||
fLast= NONE; // ignore fLast
|
||||
if (fTokenLength > 0)
|
||||
return preFix(CCODE, CHARACTER, NONE, 1);
|
||||
else {
|
||||
preFix(CCODE, CHARACTER, NONE, 1);
|
||||
fTokenOffset += fTokenLength;
|
||||
fTokenLength= fPrefixLength;
|
||||
break;
|
||||
}
|
||||
preFix(CCODE, CHARACTER, NONE, 1);
|
||||
fTokenOffset += fTokenLength;
|
||||
fTokenLength= fPrefixLength;
|
||||
break;
|
||||
|
||||
case '"':
|
||||
fLast= NONE; // ignore fLast
|
||||
if (fTokenLength > 0)
|
||||
return preFix(CCODE, STRING, NONE, 1);
|
||||
else {
|
||||
preFix(CCODE, STRING, NONE, 1);
|
||||
fTokenOffset += fTokenLength;
|
||||
fTokenLength= fPrefixLength;
|
||||
break;
|
||||
}
|
||||
preFix(CCODE, STRING, NONE, 1);
|
||||
fTokenOffset += fTokenLength;
|
||||
fTokenLength= fPrefixLength;
|
||||
break;
|
||||
|
||||
default:
|
||||
consume();
|
||||
|
@ -285,10 +273,9 @@ public class FastCPartitionScanner implements IPartitionTokenScanner, ICPartitio
|
|||
case '/':
|
||||
if (fLast == STAR) {
|
||||
return postFix(MULTI_LINE_COMMENT);
|
||||
} else {
|
||||
consume();
|
||||
break;
|
||||
}
|
||||
consume();
|
||||
break;
|
||||
|
||||
default:
|
||||
consume();
|
||||
|
@ -307,10 +294,9 @@ public class FastCPartitionScanner implements IPartitionTokenScanner, ICPartitio
|
|||
if (fLast != BACKSLASH) {
|
||||
return postFix(STRING);
|
||||
|
||||
} else {
|
||||
consume();
|
||||
break;
|
||||
}
|
||||
}
|
||||
consume();
|
||||
break;
|
||||
|
||||
default:
|
||||
consume();
|
||||
|
@ -329,10 +315,9 @@ public class FastCPartitionScanner implements IPartitionTokenScanner, ICPartitio
|
|||
if (fLast != BACKSLASH) {
|
||||
return postFix(CHARACTER);
|
||||
|
||||
} else {
|
||||
consume();
|
||||
break;
|
||||
}
|
||||
consume();
|
||||
break;
|
||||
|
||||
default:
|
||||
consume();
|
||||
|
@ -388,14 +373,13 @@ public class FastCPartitionScanner implements IPartitionTokenScanner, ICPartitio
|
|||
fLast= last;
|
||||
return fTokens[state];
|
||||
|
||||
} else {
|
||||
fTokenLength -= getLastLength(fLast);
|
||||
fLast= last;
|
||||
fPrefixLength= prefixLength;
|
||||
IToken token= fTokens[state];
|
||||
fState= newState;
|
||||
return token;
|
||||
}
|
||||
fTokenLength -= getLastLength(fLast);
|
||||
fLast= last;
|
||||
fPrefixLength= prefixLength;
|
||||
IToken token= fTokens[state];
|
||||
fState= newState;
|
||||
return token;
|
||||
}
|
||||
|
||||
private static int getState(String contentType) {
|
||||
|
|
|
@ -35,9 +35,8 @@ public class LineBreakingReader {
|
|||
if (nextWidth > fMaxWidth) {
|
||||
if (currWidth > 0) {
|
||||
return currOffset;
|
||||
} else {
|
||||
return nextOffset;
|
||||
}
|
||||
return nextOffset;
|
||||
}
|
||||
currWidth= nextWidth;
|
||||
currOffset= nextOffset;
|
||||
|
|
|
@ -115,11 +115,11 @@ public class PreprocessorRule extends WordRule implements IRule {
|
|||
|
||||
return fDefaultToken;
|
||||
|
||||
} else { // Doesn't start with '#', roll back scanner
|
||||
|
||||
for (int i = 0; i < nCharsToRollback; i++) {
|
||||
scanner.unread();
|
||||
}
|
||||
}
|
||||
// Doesn't start with '#', roll back scanner
|
||||
|
||||
for (int i = 0; i < nCharsToRollback; i++) {
|
||||
scanner.unread();
|
||||
}
|
||||
|
||||
return Token.UNDEFINED;
|
||||
|
|
|
@ -27,9 +27,8 @@ public abstract class SingleCharReader extends Reader {
|
|||
if (ch == -1) {
|
||||
if (i == off) {
|
||||
return -1;
|
||||
} else {
|
||||
return i - off;
|
||||
}
|
||||
return i - off;
|
||||
}
|
||||
cbuf[i]= (char)ch;
|
||||
}
|
||||
|
|
|
@ -68,9 +68,8 @@ public final class SingleTokenCScanner extends AbstractCScanner{
|
|||
size = end - position;
|
||||
position = end;
|
||||
return fDefaultReturnToken;
|
||||
} else {
|
||||
return Token.EOF;
|
||||
}
|
||||
return Token.EOF;
|
||||
}
|
||||
|
||||
public int getTokenLength() {
|
||||
|
|
|
@ -64,24 +64,23 @@ public abstract class SubstitutionTextReader extends SingleCharReader {
|
|||
fIndex= 0;
|
||||
}
|
||||
return ch;
|
||||
} else {
|
||||
int ch= fCharAfterWhiteSpace;
|
||||
if (ch == -1) {
|
||||
ch= fReader.read();
|
||||
}
|
||||
if (Character.isWhitespace((char)ch)) {
|
||||
do {
|
||||
ch= fReader.read();
|
||||
} while (Character.isWhitespace((char)ch));
|
||||
if (ch != -1) {
|
||||
fCharAfterWhiteSpace= ch;
|
||||
return ' ';
|
||||
}
|
||||
} else {
|
||||
fCharAfterWhiteSpace= -1;
|
||||
}
|
||||
return ch;
|
||||
}
|
||||
int ch= fCharAfterWhiteSpace;
|
||||
if (ch == -1) {
|
||||
ch= fReader.read();
|
||||
}
|
||||
if (Character.isWhitespace((char)ch)) {
|
||||
do {
|
||||
ch= fReader.read();
|
||||
} while (Character.isWhitespace((char)ch));
|
||||
if (ch != -1) {
|
||||
fCharAfterWhiteSpace= ch;
|
||||
return ' ';
|
||||
}
|
||||
} else {
|
||||
fCharAfterWhiteSpace= -1;
|
||||
}
|
||||
return ch;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -146,9 +146,8 @@ public class CEditorTextHoverDescriptor implements Comparable {
|
|||
int lastDot= label.lastIndexOf('.');
|
||||
if (lastDot >= 0 && lastDot < label.length() - 1) {
|
||||
return label.substring(lastDot + 1);
|
||||
} else {
|
||||
return label;
|
||||
}
|
||||
return label;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -283,8 +283,8 @@ public class CCompletionProposal implements ICCompletionProposal, ICompletionPro
|
|||
if (event.character == fExitCharacter) {
|
||||
if (environment.anyPositionContains(offset))
|
||||
return new ExitFlags(ILinkedModeListener.UPDATE_CARET, false);
|
||||
else
|
||||
return new ExitFlags(ILinkedModeListener.UPDATE_CARET, true);
|
||||
|
||||
return new ExitFlags(ILinkedModeListener.UPDATE_CARET, true);
|
||||
}
|
||||
|
||||
switch (event.character) {
|
||||
|
@ -420,8 +420,7 @@ public class CCompletionProposal implements ICCompletionProposal, ICompletionPro
|
|||
int pos= string.indexOf('(');
|
||||
if (pos > 0)
|
||||
return string.subSequence(0, pos);
|
||||
else
|
||||
return string;
|
||||
return string;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -13,8 +13,7 @@ package org.eclipse.cdt.internal.ui.text.contentassist;
|
|||
|
||||
import java.util.Comparator;
|
||||
|
||||
import org.eclipse.cdt.ui.text.*;
|
||||
import org.eclipse.jface.text.contentassist.ICompletionProposal;
|
||||
import org.eclipse.cdt.ui.text.ICCompletionProposal;
|
||||
|
||||
public class CCompletionProposalComparator implements Comparator {
|
||||
|
||||
|
|
|
@ -53,23 +53,21 @@ public class CoreUtility {
|
|||
Bundle bundle = Platform.getBundle(id);
|
||||
if(bundle.getState() == org.osgi.framework.Bundle.ACTIVE) {
|
||||
return element.createExecutableExtension(classAttribute);
|
||||
} else {
|
||||
final Object[] ret = new Object[1];
|
||||
final CoreException[] exc = new CoreException[1];
|
||||
BusyIndicator.showWhile(null, new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
ret[0] = element.createExecutableExtension(classAttribute);
|
||||
} catch (CoreException e) {
|
||||
exc[0] = e;
|
||||
}
|
||||
}
|
||||
});
|
||||
if (exc[0] != null)
|
||||
throw exc[0];
|
||||
else
|
||||
return ret[0];
|
||||
}
|
||||
final Object[] ret = new Object[1];
|
||||
final CoreException[] exc = new CoreException[1];
|
||||
BusyIndicator.showWhile(null, new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
ret[0] = element.createExecutableExtension(classAttribute);
|
||||
} catch (CoreException e) {
|
||||
exc[0] = e;
|
||||
}
|
||||
}
|
||||
});
|
||||
if (exc[0] != null)
|
||||
throw exc[0];
|
||||
return ret[0];
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -206,9 +206,8 @@ public class EditorUtility {
|
|||
IResource resource= unit.getResource();
|
||||
if (resource instanceof IFile) {
|
||||
return new FileEditorInput((IFile) resource);
|
||||
} else {
|
||||
return new ExternalEditorInput(unit, getStorage(unit));
|
||||
}
|
||||
return new ExternalEditorInput(unit, getStorage(unit));
|
||||
}
|
||||
|
||||
if (element instanceof IBinary) {
|
||||
|
@ -267,7 +266,7 @@ public class EditorUtility {
|
|||
if (cu.isWorkingCopy())
|
||||
return cu;
|
||||
|
||||
return (ITranslationUnit)cu.findSharedWorkingCopy(CUIPlugin.getDefault().getBufferFactory());
|
||||
return cu.findSharedWorkingCopy(CUIPlugin.getDefault().getBufferFactory());
|
||||
}
|
||||
|
||||
|
||||
|
@ -300,9 +299,8 @@ public class EditorUtility {
|
|||
IEditorDescriptor descriptor = registry.getDefaultEditor(name);
|
||||
if (descriptor != null) {
|
||||
return descriptor.getId();
|
||||
} else {
|
||||
return registry.findEditor(DEFAULT_TEXT_EDITOR_ID).getId();
|
||||
}
|
||||
return registry.findEditor(DEFAULT_TEXT_EDITOR_ID).getId();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ public class ProblemMarkerManager implements IResourceChangeListener, IAnnotatio
|
|||
}
|
||||
}
|
||||
|
||||
private ListenerList fListeners;
|
||||
ListenerList fListeners;
|
||||
|
||||
public ProblemMarkerManager() {
|
||||
fListeners = new ListenerList(5);
|
||||
|
|
|
@ -23,6 +23,7 @@ import org.eclipse.cdt.ui.CUIPlugin;
|
|||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.IResourceStatus;
|
||||
import org.eclipse.core.resources.ResourceAttributes;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
|
@ -99,8 +100,12 @@ public class Resources {
|
|||
List readOnlyFiles= new ArrayList();
|
||||
for (int i= 0; i < resources.length; i++) {
|
||||
IResource resource= resources[i];
|
||||
if (resource.getType() == IResource.FILE && resource.isReadOnly())
|
||||
readOnlyFiles.add(resource);
|
||||
if (resource.getType() == IResource.FILE) {
|
||||
ResourceAttributes attributes = resource.getResourceAttributes();
|
||||
if (attributes.isReadOnly()) {
|
||||
readOnlyFiles.add(resource);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (readOnlyFiles.size() == 0)
|
||||
return new Status(IStatus.OK, CUIPlugin.getPluginId(), IStatus.OK, "", null); //$NON-NLS-1$
|
||||
|
|
|
@ -178,10 +178,9 @@ public class StringMatcher {
|
|||
if (!fHasLeadingStar) {
|
||||
if (!regExpRegionMatches(text, start, current, 0, segLength)) {
|
||||
return false;
|
||||
} else {
|
||||
++i;
|
||||
tCurPos= tCurPos + segLength;
|
||||
}
|
||||
++i;
|
||||
tCurPos= tCurPos + segLength;
|
||||
}
|
||||
|
||||
/* process middle segments */
|
||||
|
|
|
@ -69,7 +69,7 @@ public class TableLayoutComposite extends Composite {
|
|||
|
||||
//---- Helpers -------------------------------------------------------------------------------------
|
||||
|
||||
private Point computeTableSize(Table table) {
|
||||
Point computeTableSize(Table table) {
|
||||
Point result= table.computeSize(SWT.DEFAULT, SWT.DEFAULT);
|
||||
|
||||
int width= 0;
|
||||
|
@ -91,7 +91,7 @@ public class TableLayoutComposite extends Composite {
|
|||
return result;
|
||||
}
|
||||
|
||||
private void layoutTable(Table table, int width, Rectangle area, boolean increase) {
|
||||
void layoutTable(Table table, int width, Rectangle area, boolean increase) {
|
||||
// XXX: Layout is being called with an invalid value the first time
|
||||
// it is being called on Linux. This method resets the
|
||||
// Layout to null so we make sure we run it only when
|
||||
|
|
|
@ -50,8 +50,7 @@ public class TwoArrayQuickSort {
|
|||
private static boolean smaller(String left, String right, boolean ignoreCase) {
|
||||
if (ignoreCase)
|
||||
return left.compareToIgnoreCase(right) < 0;
|
||||
else
|
||||
return left.compareTo(right) < 0;
|
||||
return left.compareTo(right) < 0;
|
||||
}
|
||||
/**
|
||||
* Sorts keys and values in parallel.
|
||||
|
|
|
@ -207,9 +207,8 @@ public class CUILabelProvider extends LabelProvider implements IColorProvider {
|
|||
if (errortick) {
|
||||
if (extra == null) {
|
||||
return new ILabelDecorator[] {};
|
||||
} else {
|
||||
return new ILabelDecorator[] { extra };
|
||||
}
|
||||
return new ILabelDecorator[] { extra };
|
||||
}
|
||||
if (extra != null) {
|
||||
return new ILabelDecorator[] { extra };
|
||||
|
|
|
@ -337,7 +337,7 @@ public class ProblemsLabelDecorator implements ILabelDecorator, ILightweightLabe
|
|||
}
|
||||
}
|
||||
|
||||
private void fireProblemsChanged(IResource[] changedResources, boolean isMarkerChange) {
|
||||
void fireProblemsChanged(IResource[] changedResources, boolean isMarkerChange) {
|
||||
if (fListeners != null && !fListeners.isEmpty()) {
|
||||
LabelProviderChangedEvent event= new ProblemsLabelChangedEvent(this, changedResources, isMarkerChange);
|
||||
Object[] listeners= fListeners.getListeners();
|
||||
|
|
|
@ -58,15 +58,14 @@ public class StatusBarUpdater implements ISelectionChangedListener {
|
|||
int nElements= selection.size();
|
||||
if (nElements > 1) {
|
||||
return CUIMessages.getFormattedString("StatusBarUpdater.num_elements_selected", String.valueOf(nElements)); //$NON-NLS-1$
|
||||
} else {
|
||||
Object elem= selection.getFirstElement();
|
||||
if (elem instanceof ICElement) {
|
||||
return formatCElementMessage((ICElement) elem);
|
||||
} else if (elem instanceof ITypeInfo) {
|
||||
return formatTypeInfoMessage((ITypeInfo) elem);
|
||||
} else if (elem instanceof IResource) {
|
||||
return formatResourceMessage((IResource) elem);
|
||||
}
|
||||
}
|
||||
Object elem= selection.getFirstElement();
|
||||
if (elem instanceof ICElement) {
|
||||
return formatCElementMessage((ICElement) elem);
|
||||
} else if (elem instanceof ITypeInfo) {
|
||||
return formatTypeInfoMessage((ITypeInfo) elem);
|
||||
} else if (elem instanceof IResource) {
|
||||
return formatResourceMessage((IResource) elem);
|
||||
}
|
||||
}
|
||||
return ""; //$NON-NLS-1$
|
||||
|
@ -84,8 +83,7 @@ public class StatusBarUpdater implements ISelectionChangedListener {
|
|||
IContainer parent= element.getParent();
|
||||
if (parent != null && parent.getType() != IResource.ROOT)
|
||||
return element.getName() + CElementLabels.CONCAT_STRING + parent.getFullPath().makeRelative().toString();
|
||||
else
|
||||
return element.getName();
|
||||
return element.getName();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -123,16 +123,15 @@ public abstract class AbstractOpenWizardAction extends Action implements IWorkbe
|
|||
ISelection selection= window.getSelectionService().getSelection();
|
||||
if (selection instanceof IStructuredSelection) {
|
||||
return (IStructuredSelection) selection;
|
||||
} else {
|
||||
// Build the selection from the IFile of the editor
|
||||
IWorkbenchPart part = window.getPartService().getActivePart();
|
||||
if (part instanceof IEditorPart) {
|
||||
IEditorInput input = ((IEditorPart) part).getEditorInput();
|
||||
if (input instanceof IFileEditorInput) {
|
||||
IFile file = ((IFileEditorInput) input).getFile();
|
||||
if (file != null)
|
||||
return new StructuredSelection(file);
|
||||
}
|
||||
}
|
||||
// Build the selection from the IFile of the editor
|
||||
IWorkbenchPart part = window.getPartService().getActivePart();
|
||||
if (part instanceof IEditorPart) {
|
||||
IEditorInput input = ((IEditorPart) part).getEditorInput();
|
||||
if (input instanceof IFileEditorInput) {
|
||||
IFile file = ((IFileEditorInput) input).getFile();
|
||||
if (file != null)
|
||||
return new StructuredSelection(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -119,10 +119,9 @@ public class CWizardRegistry {
|
|||
}
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
// fall back, if no <class> element found then assume it's a project wizard
|
||||
return true;
|
||||
}
|
||||
// fall back, if no <class> element found then assume it's a project wizard
|
||||
return true;
|
||||
}
|
||||
|
||||
public static IAction[] getProjectWizardActions() {
|
||||
|
|
|
@ -34,8 +34,7 @@ public final class BaseClassesLabelProvider implements ITableLabelProvider {
|
|||
return ACCESS_PRIVATE;
|
||||
if (access == ASTAccessVisibility.PROTECTED)
|
||||
return ACCESS_PROTECTED;
|
||||
else
|
||||
return ACCESS_PUBLIC;
|
||||
return ACCESS_PUBLIC;
|
||||
}
|
||||
|
||||
private static TypeInfoLabelProvider fTypeInfoLabelProvider = new TypeInfoLabelProvider(TypeInfoLabelProvider.SHOW_FULLY_QUALIFIED);
|
||||
|
|
|
@ -58,10 +58,9 @@ public class BaseClassesListDialogField extends ListDialogField {
|
|||
return INDEX_PUBLIC;
|
||||
}
|
||||
} else if (property.equals(CP_VIRTUAL)) {
|
||||
if (baseClass.isVirtual())
|
||||
return INDEX_YES;
|
||||
else
|
||||
return INDEX_NO;
|
||||
if (baseClass.isVirtual())
|
||||
return INDEX_YES;
|
||||
return INDEX_NO;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -41,22 +41,21 @@ public final class ConstructorMethodStub extends AbstractMethodStub {
|
|||
|
||||
public String createMethodImplementation(IQualifiedTypeName className, IBaseClassInfo[] baseClasses, String lineDelimiter) {
|
||||
//TODO should use code templates
|
||||
if (fIsInline)
|
||||
if (fIsInline) {
|
||||
return ""; //$NON-NLS-1$
|
||||
else {
|
||||
StringBuffer buf = new StringBuffer();
|
||||
buf.append(className.toString());
|
||||
buf.append("::"); //$NON-NLS-1$
|
||||
buf.append(className.toString());
|
||||
buf.append("()"); //$NON-NLS-1$
|
||||
buf.append(lineDelimiter);
|
||||
buf.append('{');
|
||||
buf.append(lineDelimiter);
|
||||
//buf.append("// TODO Auto-generated constructor stub");
|
||||
//buf.append(lineDelimiter);
|
||||
buf.append('}');
|
||||
return buf.toString();
|
||||
}
|
||||
StringBuffer buf = new StringBuffer();
|
||||
buf.append(className.toString());
|
||||
buf.append("::"); //$NON-NLS-1$
|
||||
buf.append(className.toString());
|
||||
buf.append("()"); //$NON-NLS-1$
|
||||
buf.append(lineDelimiter);
|
||||
buf.append('{');
|
||||
buf.append(lineDelimiter);
|
||||
//buf.append("// TODO Auto-generated constructor stub");
|
||||
//buf.append(lineDelimiter);
|
||||
buf.append('}');
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
public boolean isConstructor() {
|
||||
|
|
|
@ -45,22 +45,21 @@ public final class DestructorMethodStub extends AbstractMethodStub {
|
|||
|
||||
public String createMethodImplementation(IQualifiedTypeName className, IBaseClassInfo[] baseClasses, String lineDelimiter) {
|
||||
//TODO should use code templates
|
||||
if (fIsInline)
|
||||
return ""; //$NON-NLS-1$
|
||||
else {
|
||||
StringBuffer buf = new StringBuffer();
|
||||
buf.append(className.toString());
|
||||
buf.append("::~"); //$NON-NLS-1$
|
||||
buf.append(className.toString());
|
||||
buf.append("()"); //$NON-NLS-1$
|
||||
buf.append(lineDelimiter);
|
||||
buf.append('{');
|
||||
buf.append(lineDelimiter);
|
||||
//buf.append("// TODO Auto-generated destructor stub");
|
||||
//buf.append(lineDelimiter);
|
||||
buf.append('}');
|
||||
return buf.toString();
|
||||
}
|
||||
if (fIsInline) {
|
||||
return ""; //$NON-NLS-1$
|
||||
}
|
||||
StringBuffer buf = new StringBuffer();
|
||||
buf.append(className.toString());
|
||||
buf.append("::~"); //$NON-NLS-1$
|
||||
buf.append(className.toString());
|
||||
buf.append("()"); //$NON-NLS-1$
|
||||
buf.append(lineDelimiter);
|
||||
buf.append('{');
|
||||
buf.append(lineDelimiter);
|
||||
//buf.append("// TODO Auto-generated destructor stub");
|
||||
//buf.append(lineDelimiter);
|
||||
buf.append('}');
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
public boolean isDestructor() {
|
||||
|
|
|
@ -69,15 +69,13 @@ public class MethodStubsListDialogField extends CheckedListDialogField {
|
|||
return INDEX_PUBLIC;
|
||||
}
|
||||
} else if (property.equals(CP_VIRTUAL)) {
|
||||
if (stub.isVirtual())
|
||||
return INDEX_YES;
|
||||
else
|
||||
return INDEX_NO;
|
||||
if (stub.isVirtual())
|
||||
return INDEX_YES;
|
||||
return INDEX_NO;
|
||||
} else if (property.equals(CP_INLINE)) {
|
||||
if (stub.isInline())
|
||||
return INDEX_YES;
|
||||
else
|
||||
return INDEX_NO;
|
||||
if (stub.isInline())
|
||||
return INDEX_YES;
|
||||
return INDEX_NO;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -675,33 +675,32 @@ public class NewClassCodeGenerator {
|
|||
int includePos = contents.indexOf(include, startPos);
|
||||
if (includePos == -1) {
|
||||
return false;
|
||||
} else {
|
||||
if (includePos == startPos) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// TODO detect if it's commented out
|
||||
|
||||
// make sure it's on a line by itself
|
||||
int linePos = findFirstLineChar(contents, includePos);
|
||||
if (linePos == -1 || linePos == includePos) {
|
||||
return true;
|
||||
}
|
||||
boolean badLine = false;
|
||||
for (int pos = linePos; pos < includePos; ++pos) {
|
||||
char c = contents.charAt(pos);
|
||||
if (!Character.isWhitespace(c)) {
|
||||
badLine = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!badLine) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// keep searching
|
||||
startPos = includePos + include.length();
|
||||
}
|
||||
if (includePos == startPos) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// TODO detect if it's commented out
|
||||
|
||||
// make sure it's on a line by itself
|
||||
int linePos = findFirstLineChar(contents, includePos);
|
||||
if (linePos == -1 || linePos == includePos) {
|
||||
return true;
|
||||
}
|
||||
boolean badLine = false;
|
||||
for (int pos = linePos; pos < includePos; ++pos) {
|
||||
char c = contents.charAt(pos);
|
||||
if (!Character.isWhitespace(c)) {
|
||||
badLine = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!badLine) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// keep searching
|
||||
startPos = includePos + include.length();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -802,9 +801,8 @@ public class NewClassCodeGenerator {
|
|||
if (c == '\n' || c == '\r') {
|
||||
if (linePos + 1 < startPos) {
|
||||
return linePos + 1;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
--linePos;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue