[Desc.] Path info is moved to top and underlines are applied.
[Issue] REDMINE-9560
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyleRange;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.layout.FormAttachment;
private TextSourceViewerConfiguration[] fViewerConfigurations;
- /** This view's javascript element info label */
- private Label fElementInfoLabel;
+ /** This view's element info label */
+ private StyledText fElementInfoLabel;
/** The viewer's vertical ruler */
private CompositeRuler[] fVerticalRulers;
fSrcViewer.invalidateTextPresentation();
}
- fElementInfoLabel.setText(getElementInfoString());
+ String elementInfoString = getElementInfoString();
+ fElementInfoLabel.setText(elementInfoString);
+ switch (mode) {
+ case MODE_HTML:
+ case MODE_CSS:
+ break;
+ case MODE_JS:
+ setUnderlineStyle(fElementInfoLabel, elementInfoString);
+ break;
+ default:
+ break;
+ }
}
/**
}
});
- fElementInfoLabel = new Label(mainComposite, SWT.LEFT);
+ Display display= getSite().getShell().getDisplay();
+ fElementInfoLabel = new StyledText(mainComposite, SWT.LEFT);
fElementInfoLabel.setText("");
+ FontData fontData = fElementInfoLabel.getFont().getFontData()[0];
+ Font font = new Font(display, new FontData(fontData.getName(), fontData
+ .getHeight(), SWT.ITALIC));
+ fElementInfoLabel.setFont(font);
fComboBoxLabel = new Label((Composite)(tabFolder.getItem(MODE_JS).getControl()), SWT.LEFT);
fComboBoxLabel.setText("");
formData = new FormData();
formData.left = new FormAttachment(0, margin);
formData.right = new FormAttachment(100, -margin);
- formData.bottom = new FormAttachment(100, -margin);
+ formData.top = new FormAttachment(0, -margin);
fElementInfoLabel.setLayoutData(formData);
formData = new FormData();
formData.left = new FormAttachment(0, margin);
formData.right = new FormAttachment(100, -margin);
- formData.top = new FormAttachment(0, margin);
- formData.bottom = new FormAttachment(fElementInfoLabel, -margin);
+ formData.bottom = new FormAttachment(100, -margin);
+ formData.top = new FormAttachment(fElementInfoLabel, margin);
tabFolder.setLayoutData(formData);
Composite itemComposite = (Composite)(tabFolder.getItem(mode).getControl());
}
}
+ private void setUnderlineStyle(StyledText styledText, String text) {
+ StyleRange style1 = new StyleRange();
+ style1.start = 0;
+ style1.length = text.length();
+ style1.underline = true;
+ styledText.setStyleRange(style1);
+ }
+
private ISharedTextColors getSharedColors() {
return EditorsUI.getSharedTextColors();
}
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.RGB;
private TextSourceViewerConfiguration[] fViewerConfigurations;
/** This view's javascript element info label */
- private Label fElementInfoLabel;
+ private StyledText fElementInfoLabel;
/** The viewer's vertical ruler */
private CompositeRuler[] fVerticalRulers;
mainComposite.setLayout(new FormLayout());
subComposites = new Composite[NUMBER_OF_MODES];
- fElementInfoLabel = new Label(mainComposite, SWT.LEFT);
+ Display display= getSite().getShell().getDisplay();
+ fElementInfoLabel = new StyledText(mainComposite, SWT.LEFT);
+ fElementInfoLabel.setEditable(false);
fElementInfoLabel.setText("");
+ FontData fontData = fElementInfoLabel.getFont().getFontData()[0];
+ Font font = new Font(display, new FontData(fontData.getName(), fontData
+ .getHeight(), SWT.ITALIC));
+ fElementInfoLabel.setFont(font);
fComboBoxLabel = new Label(mainComposite, SWT.LEFT);
fComboBoxLabel.setText("");
IDocument document= new Document(source);
JavaScriptPlugin.getDefault().getJavaTextTools().setupJavaDocumentPartitioner(document, IJavaScriptPartitions.JAVA_PARTITIONING);
fSrcViewer.setInput(document);
-
+
+ fElementInfoLabel.setText(resourceAbsolutePath);
+ setUnderlineStyle(fElementInfoLabel, resourceAbsolutePath);
} else {
}
String source = readTextFileToString(resourceAbsolutePath);
if (source != null) {
fSrcViewer.getDocument().set(source);
+ fElementInfoLabel.setText(resourceAbsolutePath);
+ setUnderlineStyle(fElementInfoLabel, resourceAbsolutePath);
} else {
}
String source = readTextFileToString(resourceAbsolutePath);
if (source != null) {
fSrcViewer.getDocument().set(source);
+ fElementInfoLabel.setText(resourceAbsolutePath);
+ setUnderlineStyle(fElementInfoLabel, resourceAbsolutePath);
} else {
}
fComboViewer.getCombo().setVisible(true);
fComboBoxLabel.setVisible(true);
+ formData = new FormData();
+ formData.left = new FormAttachment(0, margin);
+ formData.right = new FormAttachment(100, -margin);
+ formData.top = new FormAttachment(0, margin);
+ fElementInfoLabel.setLayoutData(formData);
+
formData = new FormData();
formData.left = new FormAttachment(0, margin);
formData.right = new FormAttachment(70, -2 * margin);
- formData.top = new FormAttachment(0, margin);
+ formData.top = new FormAttachment(fElementInfoLabel, margin);
fComboViewer.getControl().setLayoutData(formData);
formData = new FormData();
formData.right = new FormAttachment(100, -margin);
formData.top = new FormAttachment(0, margin);
fComboBoxLabel.setLayoutData(formData);
-
- formData = new FormData();
- formData.left = new FormAttachment(0, margin);
- formData.right = new FormAttachment(100, -margin);
- formData.bottom = new FormAttachment(100, -margin);
- fElementInfoLabel.setLayoutData(formData);
-
+
formData = new FormData();
formData.left = new FormAttachment(0, margin);
formData.right = new FormAttachment(100, -margin);
formData.top = new FormAttachment(fComboViewer.getControl(), margin);
- formData.bottom = new FormAttachment(fElementInfoLabel, -margin);
+ formData.bottom = new FormAttachment(100, -margin);
subComposites[mode].setLayoutData(formData);
} else { //without comboviewer
fComboViewer.getCombo().setVisible(false);
formData = new FormData();
formData.left = new FormAttachment(0, margin);
formData.right = new FormAttachment(100, -margin);
- formData.bottom = new FormAttachment(100, -margin);
+ formData.top = new FormAttachment(0, margin);
fElementInfoLabel.setLayoutData(formData);
formData = new FormData();
formData.left = new FormAttachment(0, margin);
formData.right = new FormAttachment(100, -margin);
- formData.top = new FormAttachment(0, margin);
- formData.bottom = new FormAttachment(fElementInfoLabel, -margin);
+ formData.top = new FormAttachment(fElementInfoLabel, margin);
+ formData.bottom = new FormAttachment(100, -margin);
subComposites[mode].setLayoutData(formData);
}
}
}
+ private void setUnderlineStyle(StyledText styledText, String text) {
+ StyleRange style1 = new StyleRange();
+ style1.start = 0;
+ style1.length = text.length();
+ style1.underline = true;
+ styledText.setStyleRange(style1);
+ }
+
private ISharedTextColors getSharedColors() {
return EditorsUI.getSharedTextColors();
}
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.layout.FormAttachment;
/** The viewers configuration */
private JavaScriptSourceViewerConfiguration fViewerConfiguration;
/** This view's javascript element info label */
- private Label fElementInfoLabel;
+ private StyledText fElementInfoLabel;
/** This view's result info label */
private Label fComboBoxLabel;
/** The viewer's vertical ruler */
}
});
- fElementInfoLabel = new Label(mainComposite, SWT.LEFT);
+ Display display= getSite().getShell().getDisplay();
+ fElementInfoLabel = new StyledText(mainComposite, SWT.LEFT);
fElementInfoLabel.setText("");
+ FontData fontData = fElementInfoLabel.getFont().getFontData()[0];
+ Font font = new Font(display, new FontData(fontData.getName(), fontData
+ .getHeight(), SWT.ITALIC));
+ fElementInfoLabel.setFont(font);
fComboBoxLabel = new Label(mainComposite, SWT.LEFT);
fComboBoxLabel.setText("");
setInput(input);
IJavaScriptElement inputElement= fSelectedElement;
fElementInfoLabel.setText(getElementLabelString(inputElement));
+ setUnderlineStyle(fElementInfoLabel, getElementLabelString(inputElement));
//setTitleToolTip(JavaScriptElementLabels.getElementLabelExtend(inputElement, TOOLTIP_LABEL_FLAGS));
}
FormData formData;
int margin = 3;
if (mode == LAYOUT_MULTIPLE_ELEMENTS) {
+ formData = new FormData();
+ formData.left = new FormAttachment(0, margin);
+ formData.right = new FormAttachment(100, -margin);
+ formData.top = new FormAttachment(0, margin);
+ fElementInfoLabel.setLayoutData(formData);
+
formData = new FormData();
formData.left = new FormAttachment(0, margin);
formData.right = new FormAttachment(70, -2 * margin);
- formData.top = new FormAttachment(0, margin);
+ formData.top = new FormAttachment(fElementInfoLabel, -margin);
fComboViewer.getControl().setLayoutData(formData);
formData = new FormData();
formData.right = new FormAttachment(100, -margin);
formData.top = new FormAttachment(0, margin);
fComboBoxLabel.setLayoutData(formData);
-
- formData = new FormData();
- formData.left = new FormAttachment(0, margin);
- formData.right = new FormAttachment(100, -margin);
- formData.bottom = new FormAttachment(100, -margin);
- fElementInfoLabel.setLayoutData(formData);
formData = new FormData();
formData.left = new FormAttachment(0, margin);
formData.right = new FormAttachment(100, -margin);
formData.top = new FormAttachment(fComboViewer.getControl(), margin);
- formData.bottom = new FormAttachment(fElementInfoLabel, -margin);
+ formData.bottom = new FormAttachment(100, -margin);
fSrcViewer.getControl().setLayoutData(formData);
} else if (mode == LAYOUT_NORMAL) {
formData = new FormData();
formData.left = new FormAttachment(0, margin);
formData.right = new FormAttachment(100, -margin);
- formData.bottom = new FormAttachment(100, -margin);
+ formData.top = new FormAttachment(0, margin);
fElementInfoLabel.setLayoutData(formData);
formData = new FormData();
formData.left = new FormAttachment(0, margin);
formData.right = new FormAttachment(100, -margin);
- formData.top = new FormAttachment(0, margin);
- formData.bottom = new FormAttachment(fElementInfoLabel, -margin);
+ formData.top = new FormAttachment(fElementInfoLabel, margin);
+ formData.bottom = new FormAttachment(100, -margin);
fSrcViewer.getControl().setLayoutData(formData);
} else if (mode == LAYOUT_NOTHING_TO_VIEW) {
formData = new FormData();
}
}
+ private void setUnderlineStyle(StyledText styledText, String text) {
+ StyleRange style1 = new StyleRange();
+ style1.start = 0;
+ style1.length = text.length();
+ style1.underline = true;
+ styledText.setStyleRange(style1);
+ }
+
private ISharedTextColors getSharedColors() {
return EditorsUI.getSharedTextColors();
}