mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-22 14:12:10 +02:00
Cleanup: Fix obvious compiler warnings in tm.terminal.control
Change-Id: I26c0c0f049e7617d8ba58701af2efd54aa2d0768 Signed-off-by: Martin Oberhuber <martin.oberhuber@windriver.com>
This commit is contained in:
parent
3d2cdcc986
commit
0efaf9c583
14 changed files with 33 additions and 38 deletions
|
@ -18,7 +18,6 @@ import java.io.OutputStream;
|
|||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.tm.internal.terminal.control.impl.TerminalMessages;
|
||||
import org.eclipse.tm.internal.terminal.provisional.api.ISettingsPage;
|
||||
import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore;
|
||||
import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector;
|
||||
import org.eclipse.tm.internal.terminal.provisional.api.ITerminalControl;
|
||||
|
|
|
@ -187,20 +187,20 @@ public class TerminalTextData implements ITerminalTextData {
|
|||
*/
|
||||
protected void removeSnapshot(TerminalTextDataSnapshot snapshot) {
|
||||
// poor mans approach to modify the array
|
||||
List list=new ArrayList();
|
||||
List<TerminalTextDataSnapshot> list=new ArrayList<TerminalTextDataSnapshot>();
|
||||
list.addAll(Arrays.asList(fSnapshots));
|
||||
list.remove(snapshot);
|
||||
fSnapshots=(TerminalTextDataSnapshot[]) list.toArray(new TerminalTextDataSnapshot[list.size()]);
|
||||
fSnapshots=list.toArray(new TerminalTextDataSnapshot[list.size()]);
|
||||
}
|
||||
|
||||
public ITerminalTextDataSnapshot makeSnapshot() {
|
||||
// poor mans approach to modify the array
|
||||
TerminalTextDataSnapshot snapshot=new TerminalTextDataSnapshot(this);
|
||||
snapshot.markDimensionsChanged();
|
||||
List list=new ArrayList();
|
||||
List<TerminalTextDataSnapshot> list=new ArrayList<TerminalTextDataSnapshot>();
|
||||
list.addAll(Arrays.asList(fSnapshots));
|
||||
list.add(snapshot);
|
||||
fSnapshots=(TerminalTextDataSnapshot[]) list.toArray(new TerminalTextDataSnapshot[list.size()]);
|
||||
fSnapshots=list.toArray(new TerminalTextDataSnapshot[list.size()]);
|
||||
return snapshot;
|
||||
}
|
||||
public void addLine() {
|
||||
|
|
|
@ -241,17 +241,17 @@ class TerminalTextDataSnapshot implements ITerminalTextDataSnapshot {
|
|||
}
|
||||
|
||||
synchronized public void addListener(SnapshotOutOfDateListener listener) {
|
||||
List list=new ArrayList();
|
||||
List<SnapshotOutOfDateListener> list=new ArrayList<SnapshotOutOfDateListener>();
|
||||
list.addAll(Arrays.asList(fListener));
|
||||
list.add(listener);
|
||||
fListener=(SnapshotOutOfDateListener[]) list.toArray(new SnapshotOutOfDateListener[list.size()]);
|
||||
fListener=list.toArray(new SnapshotOutOfDateListener[list.size()]);
|
||||
}
|
||||
|
||||
synchronized public void removeListener(SnapshotOutOfDateListener listener) {
|
||||
List list=new ArrayList();
|
||||
List<SnapshotOutOfDateListener> list=new ArrayList<SnapshotOutOfDateListener>();
|
||||
list.addAll(Arrays.asList(fListener));
|
||||
list.remove(listener);
|
||||
fListener=(SnapshotOutOfDateListener[]) list.toArray(new SnapshotOutOfDateListener[list.size()]);
|
||||
fListener=list.toArray(new SnapshotOutOfDateListener[list.size()]);
|
||||
}
|
||||
public String toString() {
|
||||
return fSnapshot.toString();
|
||||
|
|
|
@ -98,7 +98,7 @@ public class TerminalTextDataStore implements ITerminalTextData {
|
|||
int oldSize = Array.getLength(origArray);
|
||||
if(oldSize==newSize)
|
||||
return origArray;
|
||||
Class elementType = origArray.getClass().getComponentType();
|
||||
Class<?> elementType = origArray.getClass().getComponentType();
|
||||
Object newArray = Array.newInstance(elementType, newSize);
|
||||
int preserveLength = Math.min(oldSize, newSize);
|
||||
if (preserveLength > 0)
|
||||
|
@ -130,7 +130,7 @@ public class TerminalTextDataStore implements ITerminalTextData {
|
|||
|
||||
// and create the line segments
|
||||
Style style=styles[column];
|
||||
List segments=new ArrayList();
|
||||
List<LineSegment> segments=new ArrayList<LineSegment>();
|
||||
for (int i = column; i < n; i++) {
|
||||
if(styles[i]!=style) {
|
||||
segments.add(new LineSegment(col,new String(chars,col,i-col),style));
|
||||
|
@ -141,7 +141,7 @@ public class TerminalTextDataStore implements ITerminalTextData {
|
|||
if(col < n) {
|
||||
segments.add(new LineSegment(col,new String(chars,col,n-col),style));
|
||||
}
|
||||
return (LineSegment[]) segments.toArray(new LineSegment[segments.size()]);
|
||||
return segments.toArray(new LineSegment[segments.size()]);
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.tm.internal.terminal.text.ITerminalTextData#getChar(int, int)
|
||||
|
|
|
@ -88,11 +88,11 @@ public class TerminalConnectorExtension {
|
|||
*/
|
||||
public static ITerminalConnector[] makeTerminalConnectors() {
|
||||
IConfigurationElement[] config = RegistryFactory.getRegistry().getConfigurationElementsFor("org.eclipse.tm.terminal.control.connectors"); //$NON-NLS-1$
|
||||
List result=new ArrayList();
|
||||
List<ITerminalConnector> result=new ArrayList<ITerminalConnector>();
|
||||
for (int i = 0; i < config.length; i++) {
|
||||
result.add(makeConnector(config[i]));
|
||||
}
|
||||
return (ITerminalConnector[]) result.toArray(new ITerminalConnector[result.size()]);
|
||||
return result.toArray(new ITerminalConnector[result.size()]);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@ package org.eclipse.tm.internal.terminal.provisional.api.provider;
|
|||
|
||||
import java.io.OutputStream;
|
||||
|
||||
import org.eclipse.tm.internal.terminal.provisional.api.ISettingsPage;
|
||||
import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore;
|
||||
import org.eclipse.tm.internal.terminal.provisional.api.ITerminalControl;
|
||||
import org.eclipse.tm.internal.terminal.provisional.api.Logger;
|
||||
|
|
|
@ -21,7 +21,7 @@ import org.eclipse.tm.terminal.model.ITerminalTextDataReadOnly;
|
|||
import org.eclipse.tm.terminal.model.ITerminalTextDataSnapshot;
|
||||
|
||||
abstract public class AbstractTextCanvasModel implements ITextCanvasModel {
|
||||
protected List fListeners = new ArrayList();
|
||||
protected List<ITextCanvasModelListener> fListeners = new ArrayList<ITextCanvasModelListener>();
|
||||
private int fCursorLine;
|
||||
private int fCursorColumn;
|
||||
private boolean fShowCursor;
|
||||
|
@ -56,21 +56,21 @@ abstract public class AbstractTextCanvasModel implements ITextCanvasModel {
|
|||
}
|
||||
|
||||
protected void fireCellRangeChanged(int x, int y, int width, int height) {
|
||||
for (Iterator iter = fListeners.iterator(); iter.hasNext();) {
|
||||
ITextCanvasModelListener listener = (ITextCanvasModelListener) iter.next();
|
||||
for (Iterator<ITextCanvasModelListener> iter = fListeners.iterator(); iter.hasNext();) {
|
||||
ITextCanvasModelListener listener = iter.next();
|
||||
listener.rangeChanged(x, y, width, height);
|
||||
}
|
||||
}
|
||||
protected void fireDimensionsChanged( int width,int height) {
|
||||
for (Iterator iter = fListeners.iterator(); iter.hasNext();) {
|
||||
ITextCanvasModelListener listener = (ITextCanvasModelListener) iter.next();
|
||||
for (Iterator<ITextCanvasModelListener> iter = fListeners.iterator(); iter.hasNext();) {
|
||||
ITextCanvasModelListener listener = iter.next();
|
||||
listener.dimensionsChanged(width,height);
|
||||
}
|
||||
|
||||
}
|
||||
protected void fireTerminalDataChanged() {
|
||||
for (Iterator iter = fListeners.iterator(); iter.hasNext();) {
|
||||
ITextCanvasModelListener listener = (ITextCanvasModelListener) iter.next();
|
||||
for (Iterator<ITextCanvasModelListener> iter = fListeners.iterator(); iter.hasNext();) {
|
||||
ITextCanvasModelListener listener = iter.next();
|
||||
listener.terminalDataChanged();
|
||||
}
|
||||
|
||||
|
|
|
@ -45,10 +45,9 @@ public class StyleMap {
|
|||
|
||||
private static final String PREFIX = "org.eclipse.tm.internal."; //$NON-NLS-1$
|
||||
String fFontName=ITerminalConstants.FONT_DEFINITION;
|
||||
Map fColorMapForeground=new HashMap();
|
||||
Map fColorMapBackground=new HashMap();
|
||||
Map fColorMapIntense=new HashMap();
|
||||
Map fFontMap=new HashMap();
|
||||
Map<StyleColor, Color> fColorMapForeground=new HashMap<StyleColor, Color>();
|
||||
Map<StyleColor, Color> fColorMapBackground=new HashMap<StyleColor, Color>();
|
||||
Map<StyleColor, Color> fColorMapIntense=new HashMap<StyleColor, Color>();
|
||||
private Point fCharSize;
|
||||
private final Style fDefaultStyle;
|
||||
private boolean fInvertColors;
|
||||
|
@ -121,7 +120,7 @@ public class StyleMap {
|
|||
setColor(fColorMapIntense, GRAY, 255, 255, 255);
|
||||
}
|
||||
|
||||
private void setColor(Map colorMap, String name, int r, int g, int b) {
|
||||
private void setColor(Map<StyleColor, Color> colorMap, String name, int r, int g, int b) {
|
||||
String colorName=PREFIX+r+"-"+g+"-"+b; //$NON-NLS-1$//$NON-NLS-2$
|
||||
Color color=JFaceResources.getColorRegistry().get(colorName);
|
||||
if(color==null) {
|
||||
|
@ -134,7 +133,7 @@ public class StyleMap {
|
|||
|
||||
public Color getForegrondColor(Style style) {
|
||||
style = defaultIfNull(style);
|
||||
Map map = style.isBold() ? fColorMapIntense : fColorMapForeground;
|
||||
Map<StyleColor, Color> map = style.isBold() ? fColorMapIntense : fColorMapForeground;
|
||||
//Map map = fColorMapForeground;
|
||||
if(style.isReverse())
|
||||
return getColor(map ,style.getBackground());
|
||||
|
@ -148,8 +147,8 @@ public class StyleMap {
|
|||
else
|
||||
return getColor(fColorMapBackground,style.getBackground());
|
||||
}
|
||||
Color getColor(Map map,StyleColor color) {
|
||||
Color c=(Color) map.get(color);
|
||||
Color getColor(Map<StyleColor, Color> map,StyleColor color) {
|
||||
Color c=map.get(color);
|
||||
if(c==null) {
|
||||
c=Display.getCurrent().getSystemColor(SWT.COLOR_GRAY);
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ public class Style {
|
|||
private final boolean fBlink;
|
||||
private final boolean fUnderline;
|
||||
private final boolean fReverse;
|
||||
private final static Map fgStyles=new HashMap();
|
||||
private final static Map<Style, Style> fgStyles=new HashMap<Style, Style>();
|
||||
private Style(StyleColor forground, StyleColor background, boolean bold, boolean blink, boolean underline, boolean reverse) {
|
||||
fForground = forground;
|
||||
fBackground = background;
|
||||
|
@ -41,7 +41,7 @@ public class Style {
|
|||
Style style = new Style(forground,background, bold, blink,underline,reverse);
|
||||
Style cached;
|
||||
synchronized (fgStyles) {
|
||||
cached=(Style) fgStyles.get(style);
|
||||
cached=fgStyles.get(style);
|
||||
if(cached==null) {
|
||||
cached=style;
|
||||
fgStyles.put(cached, cached);
|
||||
|
|
|
@ -19,7 +19,7 @@ import java.util.Map;
|
|||
* Threadsafe.
|
||||
*/
|
||||
public class StyleColor {
|
||||
private final static Map fgStyleColors=new HashMap();
|
||||
private final static Map<String, StyleColor> fgStyleColors=new HashMap<String, StyleColor>();
|
||||
final String fName;
|
||||
|
||||
/**
|
||||
|
@ -30,7 +30,7 @@ public class StyleColor {
|
|||
public static StyleColor getStyleColor(String name) {
|
||||
StyleColor result;
|
||||
synchronized (fgStyleColors) {
|
||||
result=(StyleColor) fgStyleColors.get(name);
|
||||
result=fgStyleColors.get(name);
|
||||
if(result==null) {
|
||||
result=new StyleColor(name);
|
||||
fgStyleColors.put(name, result);
|
||||
|
|
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
|||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: %pluginName
|
||||
Bundle-SymbolicName: org.eclipse.tm.terminal.test;singleton:=true
|
||||
Bundle-Version: 4.0.0.qualifier
|
||||
Bundle-Version: 4.0.100.qualifier
|
||||
Bundle-Vendor: %providerName
|
||||
Bundle-Localization: plugin
|
||||
Require-Bundle: org.junit,
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<relativePath>../../admin/pom-build.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<version>4.0.0-SNAPSHOT</version>
|
||||
<version>4.0.100-SNAPSHOT</version>
|
||||
<artifactId>org.eclipse.tm.terminal.test</artifactId>
|
||||
<packaging>eclipse-test-plugin</packaging>
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ import junit.framework.TestCase;
|
|||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.tm.internal.terminal.provisional.api.ISettingsPage;
|
||||
import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore;
|
||||
import org.eclipse.tm.internal.terminal.provisional.api.ITerminalControl;
|
||||
import org.eclipse.tm.internal.terminal.provisional.api.TerminalState;
|
||||
|
|
|
@ -21,7 +21,6 @@ import junit.framework.TestCase;
|
|||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.tm.internal.terminal.connector.TerminalConnector.Factory;
|
||||
import org.eclipse.tm.internal.terminal.provisional.api.ISettingsPage;
|
||||
import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore;
|
||||
import org.eclipse.tm.internal.terminal.provisional.api.ITerminalControl;
|
||||
import org.eclipse.tm.internal.terminal.provisional.api.TerminalState;
|
||||
|
|
Loading…
Add table
Reference in a new issue