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