diff options
9 files changed, 80 insertions, 16 deletions
diff --git a/org.eclipse.ui.editors/plugin.xml b/org.eclipse.ui.editors/plugin.xml index d8666ad8d..00577f4ab 100644 --- a/org.eclipse.ui.editors/plugin.xml +++ b/org.eclipse.ui.editors/plugin.xml @@ -742,7 +742,7 @@ <!-- linked annotations --> <specification annotationType="org.eclipse.ui.internal.workbench.texteditor.link.master" - colorPreferenceValue="70,100,165" + colorPreferenceValue="50,70,120" colorPreferenceKey="linked.focus.color" isGoToPreviousNavigationTarget="false" isGoToPreviousNavigationTargetKey="linked.focus.navigation.previous" @@ -792,7 +792,7 @@ </specification> <specification annotationType="org.eclipse.ui.internal.workbench.texteditor.link.target" - colorPreferenceValue="70,100,165" + colorPreferenceValue="170,185,220" colorPreferenceKey="linked.target.color" isGoToPreviousNavigationTarget="false" isGoToPreviousNavigationTargetKey="linked.target.navigation.previous" diff --git a/org.eclipse.ui.editors/schema/markerAnnotationSpecification.exsd b/org.eclipse.ui.editors/schema/markerAnnotationSpecification.exsd index 4c4b64abb..aa551ebc6 100644 --- a/org.eclipse.ui.editors/schema/markerAnnotationSpecification.exsd +++ b/org.eclipse.ui.editors/schema/markerAnnotationSpecification.exsd @@ -269,6 +269,7 @@ since: 3.0 <documentation> the default value for the "show in text" decoration style since: 3.0 +DASHED_BOX: since 3.3 </documentation> </annotation> <simpleType> @@ -277,6 +278,8 @@ since: 3.0 </enumeration> <enumeration value="BOX"> </enumeration> + <enumeration value="DASHED_BOX"> + </enumeration> <enumeration value="UNDERLINE"> </enumeration> <enumeration value="IBEAM"> diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/AnnotationsConfigurationBlock.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/AnnotationsConfigurationBlock.java index 5e0517556..38d38660c 100644 --- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/AnnotationsConfigurationBlock.java +++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/AnnotationsConfigurationBlock.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. + * Copyright (c) 2000, 2007 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -182,6 +182,7 @@ class AnnotationsConfigurationBlock implements IPreferenceConfigurationBlock { final static String[] HIGHLIGHT= new String[] {TextEditorMessages.AnnotationsConfigurationBlock_HIGHLIGHT, "not used"}; //$NON-NLS-1$ final static String[] UNDERLINE= new String[] {TextEditorMessages.AnnotationsConfigurationBlock_UNDERLINE, AnnotationPreference.STYLE_UNDERLINE}; final static String[] BOX= new String[] {TextEditorMessages.AnnotationsConfigurationBlock_BOX, AnnotationPreference.STYLE_BOX}; + final static String[] DASHED_BOX= new String[] {TextEditorMessages.AnnotationsConfigurationBlock_DASHED_BOX, AnnotationPreference.STYLE_DASHED_BOX}; final static String[] IBEAM= new String[] {TextEditorMessages.AnnotationsConfigurationBlock_IBEAM, AnnotationPreference.STYLE_IBEAM}; final static String[] SQUIGGLES= new String[] {TextEditorMessages.AnnotationsConfigurationBlock_SQUIGGLES, AnnotationPreference.STYLE_SQUIGGLES}; @@ -297,7 +298,7 @@ class AnnotationsConfigurationBlock implements IPreferenceConfigurationBlock { gd= new GridData(GridData.FILL_HORIZONTAL); gd.horizontalAlignment= GridData.BEGINNING; fDecorationViewer.getControl().setLayoutData(gd); - fDecorationViewer.setInput(new Object[] {HIGHLIGHT, SQUIGGLES, BOX, UNDERLINE, IBEAM}); + fDecorationViewer.setInput(new Object[] {HIGHLIGHT, SQUIGGLES, BOX, DASHED_BOX, UNDERLINE, IBEAM}); fShowInOverviewRulerCheckBox= new Button(optionsComposite, SWT.CHECK); fShowInOverviewRulerCheckBox.setText(TextEditorMessages.AnnotationsConfigurationBlock_showInOverviewRuler); @@ -678,6 +679,7 @@ class AnnotationsConfigurationBlock implements IPreferenceConfigurationBlock { if (item.textStyleKey != null) { list.add(UNDERLINE); list.add(BOX); + list.add(DASHED_BOX); list.add(IBEAM); } diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/LinkedModeConfigurationBlock.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/LinkedModeConfigurationBlock.java index 411302a78..f706e5fe8 100755 --- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/LinkedModeConfigurationBlock.java +++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/LinkedModeConfigurationBlock.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. + * Copyright (c) 2000, 2007 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -124,6 +124,7 @@ class LinkedModeConfigurationBlock implements IPreferenceConfigurationBlock { final static String[] HIGHLIGHT= new String[] {TextEditorMessages.LinkedModeConfigurationBlock_HIGHLIGHT, "unused"}; //$NON-NLS-1$ final static String[] UNDERLINE= new String[] {TextEditorMessages.LinkedModeConfigurationBlock_UNDERLINE, AnnotationPreference.STYLE_UNDERLINE}; final static String[] BOX= new String[] {TextEditorMessages.LinkedModeConfigurationBlock_BOX, AnnotationPreference.STYLE_BOX}; + final static String[] DASHED_BOX= new String[] {TextEditorMessages.LinkedModeConfigurationBlock_DASHED_BOX, AnnotationPreference.STYLE_DASHED_BOX}; final static String[] IBEAM= new String[] {TextEditorMessages.LinkedModeConfigurationBlock_IBEAM, AnnotationPreference.STYLE_IBEAM}; final static String[] SQUIGGLES= new String[] {TextEditorMessages.LinkedModeConfigurationBlock_SQUIGGLES, AnnotationPreference.STYLE_SQUIGGLES}; @@ -201,11 +202,11 @@ class LinkedModeConfigurationBlock implements IPreferenceConfigurationBlock { private List getStyles(Object type) { if (type.equals(MASTER)) - return Arrays.asList(new String[][] {BOX, HIGHLIGHT, UNDERLINE, SQUIGGLES}); + return Arrays.asList(new String[][] {BOX, DASHED_BOX, HIGHLIGHT, UNDERLINE, SQUIGGLES}); if (type.equals(SLAVE)) - return Arrays.asList(new String[][] {BOX, HIGHLIGHT, UNDERLINE, SQUIGGLES}); + return Arrays.asList(new String[][] {BOX, DASHED_BOX, HIGHLIGHT, UNDERLINE, SQUIGGLES}); if (type.equals(TARGET)) - return Arrays.asList(new String[][] {BOX, HIGHLIGHT, UNDERLINE, SQUIGGLES}); + return Arrays.asList(new String[][] {BOX, DASHED_BOX, HIGHLIGHT, UNDERLINE, SQUIGGLES}); if (type.equals(EXIT)) return Arrays.asList(new String[][] {IBEAM}); return new ArrayList(); @@ -273,7 +274,7 @@ class LinkedModeConfigurationBlock implements IPreferenceConfigurationBlock { gd= new GridData(GridData.FILL_HORIZONTAL); gd.horizontalAlignment= GridData.BEGINNING; fDecorationViewer.getControl().setLayoutData(gd); - fDecorationViewer.setInput(new Object[] {HIGHLIGHT, SQUIGGLES, BOX, UNDERLINE, IBEAM}); + fDecorationViewer.setInput(new Object[] {HIGHLIGHT, SQUIGGLES, BOX, DASHED_BOX, UNDERLINE, IBEAM}); label= new Label(optionsComposite, SWT.LEFT); label.setText(TextEditorMessages.LinkedModeConfigurationBlock_color); diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorMessages.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorMessages.java index deec5700e..829f01e1c 100644 --- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorMessages.java +++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorMessages.java @@ -25,7 +25,9 @@ final class TextEditorMessages extends NLS { // Do not instantiate } + public static String AnnotationsConfigurationBlock_DASHED_BOX; public static String EditorsPlugin_internal_error; + public static String LinkedModeConfigurationBlock_DASHED_BOX; public static String TextEditorPreferencePage_displayedTabWidth; public static String TextEditorPreferencePage_convertTabsToSpaces; public static String TextEditorPreferencePage_undoHistorySize; diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorMessages.properties b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorMessages.properties index 066504307..6ebeb122f 100644 --- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorMessages.properties +++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorMessages.properties @@ -63,6 +63,7 @@ NewTextEditorAction_namePrefix=Untitled AnnotationsConfigurationBlock_description= General annotation settings. AnnotationsConfigurationBlock_showInText=&Text as +AnnotationsConfigurationBlock_DASHED_BOX=Dashed Box AnnotationsConfigurationBlock_showInOverviewRuler=&Overview ruler AnnotationsConfigurationBlock_showInVerticalRuler=&Vertical ruler AnnotationsConfigurationBlock_annotationPresentationOptions=Annotation ty&pes: @@ -124,6 +125,7 @@ LinkedModeConfigurationBlock_UNDERLINE=Underlined LinkedModeConfigurationBlock_BOX=Box LinkedModeConfigurationBlock_IBEAM=Vertical Bar LinkedModeConfigurationBlock_HIGHLIGHT=Highlighted +LinkedModeConfigurationBlock_DASHED_BOX=Dashed Box LinkedModeConfigurationBlock_labels_showIn=&Show in text as: LinkedModeConfigurationBlock_color= C&olor: LinkedModeConfigurationBlock_linking_title=Lin&ked Mode diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerAnnotationPreferences.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerAnnotationPreferences.java index 7397f01e3..ec4ce36e4 100644 --- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerAnnotationPreferences.java +++ b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerAnnotationPreferences.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. + * Copyright (c) 2000, 2007 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -528,6 +528,7 @@ public class MarkerAnnotationPreferences { if (s != null && s.trim().length() > 0) { if (AnnotationPreference.STYLE_BOX.equals(s) + || AnnotationPreference.STYLE_DASHED_BOX.equals(s) || AnnotationPreference.STYLE_IBEAM.equals(s) || AnnotationPreference.STYLE_SQUIGGLES.equals(s) || AnnotationPreference.STYLE_UNDERLINE.equals(s)) diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AnnotationPreference.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AnnotationPreference.java index a89b54dc2..b76484426 100644 --- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AnnotationPreference.java +++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AnnotationPreference.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. + * Copyright (c) 2000, 2007 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -95,6 +95,13 @@ public class AnnotationPreference { * @since 3.0 */ public static final String STYLE_BOX= "BOX"; //$NON-NLS-1$ + + /** + * Constant defining dashed box decoration for the show in text style preference. + * @since 3.3 + */ + public static final String STYLE_DASHED_BOX= "DASHED_BOX"; //$NON-NLS-1$ + /** * Constant defining underline decoration for the show in text style preference. * @since 3.0 @@ -911,7 +918,7 @@ public class AnnotationPreference { * @since 3.0 */ public void setTextStyleValue(String value) { - if (!STYLE_NONE.equals(value) && !STYLE_BOX.equals(value) + if (!STYLE_NONE.equals(value) && !STYLE_BOX.equals(value) && !STYLE_DASHED_BOX.equals(value) && !STYLE_IBEAM.equals(value) && !STYLE_SQUIGGLES.equals(value) && !STYLE_UNDERLINE.equals(value)) throw new IllegalArgumentException(); diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/SourceViewerDecorationSupport.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/SourceViewerDecorationSupport.java index dadf47432..bf61d0c6f 100644 --- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/SourceViewerDecorationSupport.java +++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/SourceViewerDecorationSupport.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. + * Copyright (c) 2000, 2007 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -15,6 +15,7 @@ import java.util.HashMap; import java.util.Iterator; import java.util.Map; +import org.eclipse.swt.SWT; import org.eclipse.swt.custom.StyledText; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.GC; @@ -25,9 +26,6 @@ import org.eclipse.swt.graphics.Rectangle; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.preference.PreferenceConverter; import org.eclipse.jface.resource.JFaceResources; -import org.eclipse.jface.util.IPropertyChangeListener; -import org.eclipse.jface.util.PropertyChangeEvent; - import org.eclipse.jface.text.CursorLinePainter; import org.eclipse.jface.text.IPainter; import org.eclipse.jface.text.ITextViewerExtension2; @@ -42,6 +40,8 @@ import org.eclipse.jface.text.source.ISharedTextColors; import org.eclipse.jface.text.source.ISourceViewer; import org.eclipse.jface.text.source.MatchingCharacterPainter; import org.eclipse.jface.text.source.AnnotationPainter.IDrawingStrategy; +import org.eclipse.jface.util.IPropertyChangeListener; +import org.eclipse.jface.util.PropertyChangeEvent; /** * Support class used by text editors to draw and update decorations on the @@ -150,7 +150,46 @@ public class SourceViewerDecorationSupport { } } } + + /** + * Dashed box drawing strategy. + * + * @since 3.3 + */ + private static final class DashedBoxDrawingStrategy implements IDrawingStrategy { + + /* + * @see org.eclipse.jface.text.source.AnnotationPainter.IDrawingStrategy#draw(org.eclipse.jface.text.source.Annotation, org.eclipse.swt.graphics.GC, org.eclipse.swt.custom.StyledText, int, int, org.eclipse.swt.graphics.Color) + */ + public void draw(Annotation annotation, GC gc, StyledText textWidget, int offset, int length, Color color) { + if (gc != null) { + Rectangle bounds; + if (length > 0) + bounds= textWidget.getTextBounds(offset, offset + length - 1); + else { + Point loc= textWidget.getLocationAtOffset(offset); + bounds= new Rectangle(loc.x, loc.y, 1, textWidget.getLineHeight(offset)); + } + + //clean bg: + gc.setForeground(textWidget.getBackground()); + gc.setLineStyle(SWT.LINE_SOLID); + gc.drawRectangle(bounds.x, bounds.y, bounds.width - 1, bounds.height - 1); + + gc.setForeground(color); + gc.setLineDash(new int[] { 3 }); + gc.drawRectangle(bounds.x, bounds.y, bounds.width - 1, bounds.height - 1); + + //RESET (same GC is passed around!): + gc.setLineStyle(SWT.LINE_SOLID); + + } else { + textWidget.redrawRange(offset, length, true); + } + } + } + /** * Draws an iBeam at the given offset, the length is ignored. * @@ -214,6 +253,12 @@ public class SourceViewerDecorationSupport { * @since 3.0 */ private static IDrawingStrategy fgBoxStrategy= new BoxDrawingStrategy(); + + /** + * The dashed box drawing strategy. + * @since 3.3 + */ + private static IDrawingStrategy fgDashedBoxStrategy= new DashedBoxDrawingStrategy(); /** * The null drawing strategy. @@ -882,6 +927,7 @@ public class SourceViewerDecorationSupport { * see: https://bugs.eclipse.org/bugs/show_bug.cgi?id=51498 */ painter.addDrawingStrategy(AnnotationPreference.STYLE_BOX, fgBoxStrategy); + painter.addDrawingStrategy(AnnotationPreference.STYLE_DASHED_BOX, fgDashedBoxStrategy); painter.addDrawingStrategy(AnnotationPreference.STYLE_NONE, fgNullStrategy); painter.addDrawingStrategy(AnnotationPreference.STYLE_SQUIGGLES, fgSquigglesStrategy); painter.addDrawingStrategy(AnnotationPreference.STYLE_UNDERLINE, fgUnderlineStrategy); |