mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 08:55:25 +02:00
Fixed warnings in org.eclipse.cdt.internal.ui.util
This commit is contained in:
parent
c3a1c183b0
commit
1853f55894
10 changed files with 59 additions and 66 deletions
|
@ -10,19 +10,10 @@
|
|||
**********************************************************************/
|
||||
package org.eclipse.cdt.internal.ui.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||
import org.eclipse.cdt.internal.ui.CHelpProviderManager;
|
||||
import org.eclipse.cdt.internal.ui.editor.CEditor;
|
||||
import org.eclipse.cdt.internal.ui.text.CWordFinder;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
import org.eclipse.cdt.ui.ICHelpResourceDescriptor;
|
||||
import org.eclipse.cdt.ui.text.ICHelpInvocationContext;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.help.HelpSystem;
|
||||
|
@ -34,6 +25,15 @@ import org.eclipse.jface.text.ITextSelection;
|
|||
import org.eclipse.ui.IEditorInput;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
|
||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
import org.eclipse.cdt.ui.ICHelpResourceDescriptor;
|
||||
import org.eclipse.cdt.ui.text.ICHelpInvocationContext;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.CHelpProviderManager;
|
||||
import org.eclipse.cdt.internal.ui.editor.CEditor;
|
||||
import org.eclipse.cdt.internal.ui.text.CWordFinder;
|
||||
|
||||
/**
|
||||
*
|
||||
* @since 2.1
|
||||
|
@ -111,14 +111,6 @@ public class CHelpDisplayContext implements IContext {
|
|||
}
|
||||
}
|
||||
|
||||
private boolean doesNotExist(URL url) {
|
||||
if (url.getProtocol().equals("file")) { //$NON-NLS-1$
|
||||
File file= new File(url.getFile());
|
||||
return !file.exists();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public IHelpResource[] getRelatedTopics() {
|
||||
return fHelpResources;
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ public class CoreUtility {
|
|||
// If plugin has been loaded create extension.
|
||||
// Otherwise, show busy cursor then create extension.
|
||||
|
||||
String id = element.getDeclaringExtension().getNamespace();
|
||||
String id= element.getContributor().getName();
|
||||
Bundle bundle = Platform.getBundle(id);
|
||||
if(bundle.getState() == org.osgi.framework.Bundle.ACTIVE) {
|
||||
return element.createExecutableExtension(classAttribute);
|
||||
|
@ -90,6 +90,19 @@ public class CoreUtility {
|
|||
*/
|
||||
public static int safeHashcode(Object o) {
|
||||
return o == null ? 0 : o.hashCode();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Comparse two integers.
|
||||
*/
|
||||
public static int compare(int lhs, int rhs) {
|
||||
if (lhs < rhs) {
|
||||
return -1;
|
||||
}
|
||||
if (lhs > rhs) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -14,9 +14,7 @@ public interface IDebugLogConstants {
|
|||
public class DebugLogConstant {
|
||||
private DebugLogConstant( int value )
|
||||
{
|
||||
this.value = value;
|
||||
}
|
||||
private final int value;
|
||||
}
|
||||
|
||||
public static final DebugLogConstant CONTENTASSIST = new DebugLogConstant ( 1 );
|
||||
|
|
|
@ -40,7 +40,7 @@ public class ImageDescriptorRegistry {
|
|||
* Creates a new image descriptor registry for the given display. All images
|
||||
* managed by this registry will be disposed when the display gets disposed.
|
||||
*
|
||||
* @param diaplay the display the images managed by this registry are allocated for
|
||||
* @param display the display the images managed by this registry are allocated for
|
||||
*/
|
||||
public ImageDescriptorRegistry(Display display) {
|
||||
fDisplay= display;
|
||||
|
|
|
@ -28,28 +28,28 @@ public class PixelConverter {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jface.dialogs.DialogPage#convertHeightInCharsToPixels(int)
|
||||
* @see Dialog#convertHeightInCharsToPixels(FontMetrics, int)
|
||||
*/
|
||||
public int convertHeightInCharsToPixels(int chars) {
|
||||
return Dialog.convertHeightInCharsToPixels(fFontMetrics, chars);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jface.dialogs.DialogPage#convertHorizontalDLUsToPixels(int)
|
||||
* @see Dialog#convertHorizontalDLUsToPixels(FontMetrics, int)
|
||||
*/
|
||||
public int convertHorizontalDLUsToPixels(int dlus) {
|
||||
return Dialog.convertHorizontalDLUsToPixels(fFontMetrics, dlus);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jface.dialogs.DialogPage#convertVerticalDLUsToPixels(int)
|
||||
* @see Dialog#convertVerticalDLUsToPixels(FontMetrics, int)
|
||||
*/
|
||||
public int convertVerticalDLUsToPixels(int dlus) {
|
||||
return Dialog.convertVerticalDLUsToPixels(fFontMetrics, dlus);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jface.dialogs.DialogPage#convertWidthInCharsToPixels(int)
|
||||
* @see Dialog#convertWidthInCharsToPixels(FontMetrics, int)
|
||||
*/
|
||||
public int convertWidthInCharsToPixels(int chars) {
|
||||
return Dialog.convertWidthInCharsToPixels(fFontMetrics, chars);
|
||||
|
|
|
@ -13,8 +13,6 @@ package org.eclipse.cdt.internal.ui.util;
|
|||
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.editor.TranslationUnitAnnotationModelEvent;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
import org.eclipse.core.resources.IMarker;
|
||||
import org.eclipse.core.resources.IMarkerDelta;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
|
@ -24,13 +22,17 @@ import org.eclipse.core.resources.IResourceChangeListener;
|
|||
import org.eclipse.core.resources.IResourceDelta;
|
||||
import org.eclipse.core.resources.IResourceDeltaVisitor;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.ListenerList;
|
||||
import org.eclipse.jface.text.source.AnnotationModelEvent;
|
||||
import org.eclipse.jface.text.source.IAnnotationModel;
|
||||
import org.eclipse.jface.text.source.IAnnotationModelListener;
|
||||
import org.eclipse.jface.text.source.IAnnotationModelListenerExtension;
|
||||
import org.eclipse.jface.util.ListenerList;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.editor.TranslationUnitAnnotationModelEvent;
|
||||
|
||||
/**
|
||||
* Listens to resource deltas and filters for marker changes of type
|
||||
* IMarker.PROBLEM Viewers showing error ticks should register as listener to
|
||||
|
@ -95,7 +97,7 @@ public class ProblemMarkerManager implements IResourceChangeListener, IAnnotatio
|
|||
ListenerList fListeners;
|
||||
|
||||
public ProblemMarkerManager() {
|
||||
fListeners = new ListenerList(5);
|
||||
fListeners = new ListenerList();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -164,7 +164,6 @@ public class ProblemTreeViewer extends TreeViewer {
|
|||
|
||||
/**
|
||||
* This returns the editor corresponding to the opened CEditor that is listening to the selection changes on the Outline View.
|
||||
* @return
|
||||
*/
|
||||
public CEditor getEditor() {
|
||||
return editor;
|
||||
|
|
|
@ -84,6 +84,8 @@ public class SWTUtil {
|
|||
|
||||
/**
|
||||
* Returns a height hint for a button control.
|
||||
* @deprecated
|
||||
* @see IDialogConstants#BUTTON_HEIGHT
|
||||
*/
|
||||
public static int getButtonHeigthHint(Button button) {
|
||||
if (button.getFont().equals(JFaceResources.getDefaultFont()))
|
||||
|
@ -94,17 +96,16 @@ public class SWTUtil {
|
|||
|
||||
|
||||
/**
|
||||
* Sets width and height hint for the button control.
|
||||
* Sets width for the button control.
|
||||
* <b>Note:</b> This is a NOP if the button's layout data is not
|
||||
* an instance of <code>GridData</code>.
|
||||
*
|
||||
* @param the button for which to set the dimension hint
|
||||
* @param button a button for which to set the dimension hint
|
||||
*/
|
||||
public static void setButtonDimensionHint(Button button) {
|
||||
Assert.isNotNull(button);
|
||||
Object gd= button.getLayoutData();
|
||||
if (gd instanceof GridData) {
|
||||
((GridData)gd).heightHint= getButtonHeigthHint(button);
|
||||
((GridData)gd).widthHint= getButtonWidthHint(button);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,9 +45,9 @@ public class StringMatcher {
|
|||
/**
|
||||
* Find the first occurrence of the pattern between <code>start</code)(inclusive)
|
||||
* and <code>end</code>(exclusive).
|
||||
* @param <code>text</code>, the String object to search in
|
||||
* @param <code>start</code>, the starting index of the search range, inclusive
|
||||
* @param <code>end</code>, the ending index of the search range, exclusive
|
||||
* @param text the String object to search in
|
||||
* @param start the starting index of the search range, inclusive
|
||||
* @param end the ending index of the search range, exclusive
|
||||
* @return an <code>StringMatcher.Position</code> object that keeps the starting
|
||||
* (inclusive) and ending positions (exclusive) of the first occurrence of the
|
||||
* pattern in the specified range of the text; return null if not found or subtext
|
||||
|
@ -145,9 +145,9 @@ public class StringMatcher {
|
|||
* Given the starting (inclusive) and the ending (exclusive) poisitions in the
|
||||
* <code>text</code>, determine if the given substring matches with aPattern
|
||||
* @return true if the specified portion of the text matches the pattern
|
||||
* @param String <code>text</code>, a String object that contains the substring to match
|
||||
* @param int <code>start<code> marks the starting position (inclusive) of the substring
|
||||
* @param int <code>end<code> marks the ending index (exclusive) of the substring
|
||||
* @param text a String object that contains the substring to match
|
||||
* @param start marks the starting position (inclusive) of the substring
|
||||
* @param end marks the ending index (exclusive) of the substring
|
||||
*/
|
||||
public boolean match(String text, int start, int end) {
|
||||
if (null == fPattern || null == text)
|
||||
|
@ -216,7 +216,7 @@ public class StringMatcher {
|
|||
/**
|
||||
* match the given <code>text</code> with the pattern
|
||||
* @return true if matched eitherwise false
|
||||
* @param <code>text</code>, a String object
|
||||
* @param text a String object
|
||||
*/
|
||||
public boolean match(String text) {
|
||||
return match(text, 0, text.length());
|
||||
|
@ -232,7 +232,6 @@ public class StringMatcher {
|
|||
}
|
||||
/**
|
||||
* This method parses the given pattern into segments seperated by wildcard '*' characters.
|
||||
* @param p, a String object that is a simple regular expression with * and/or ?
|
||||
*/
|
||||
private void parseWildCards() {
|
||||
if (fPattern.startsWith("*")) //$NON-NLS-1$
|
||||
|
@ -293,9 +292,9 @@ public class StringMatcher {
|
|||
temp.copyInto(fSegments);
|
||||
}
|
||||
/**
|
||||
* @param <code>text</code>, a string which contains no wildcard
|
||||
* @param <code>start</code>, the starting index in the text for search, inclusive
|
||||
* @param <code>end</code>, the stopping point of search, exclusive
|
||||
* @param text a string which contains no wildcard
|
||||
* @param start the starting index in the text for search, inclusive
|
||||
* @param end the stopping point of search, exclusive
|
||||
* @return the starting index in the text of the pattern , or -1 if not found
|
||||
*/
|
||||
protected int posIn(String text, int start, int end) { //no wild card in pattern
|
||||
|
@ -316,11 +315,10 @@ public class StringMatcher {
|
|||
return -1;
|
||||
}
|
||||
/**
|
||||
* @param <code>text</code>, a simple regular expression that may only contain '?'(s)
|
||||
* @param <code>start</code>, the starting index in the text for search, inclusive
|
||||
* @param <code>end</code>, the stopping point of search, exclusive
|
||||
* @param <code>p</code>, a simple regular expression that may contains '?'
|
||||
* @param <code>caseIgnored</code>, wether the pattern is not casesensitive
|
||||
* @param text a simple regular expression that may only contain '?'(s)
|
||||
* @param start the starting index in the text for search, inclusive
|
||||
* @param end the stopping point of search, exclusive
|
||||
* @param p a simple regular expression that may contains '?'
|
||||
* @return the starting index in the text of the pattern , or -1 if not found
|
||||
*/
|
||||
protected int regExpPosIn(String text, int start, int end, String p) {
|
||||
|
@ -333,15 +331,7 @@ public class StringMatcher {
|
|||
}
|
||||
return -1;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @return boolean
|
||||
* @param <code>text</code>, a String to match
|
||||
* @param <code>start</code>, int that indicates the starting index of match, inclusive
|
||||
* @param <code>end</code> int that indicates the ending index of match, exclusive
|
||||
* @param <code>p</code>, String, String, a simple regular expression that may contain '?'
|
||||
* @param <code>ignoreCase</code>, boolean indicating wether code>p</code> is case sensitive
|
||||
*/
|
||||
|
||||
protected boolean regExpRegionMatches(String text, int tStart, String p, int pStart, int plen) {
|
||||
while (plen-- > 0) {
|
||||
char tchar= text.charAt(tStart++);
|
||||
|
@ -366,11 +356,10 @@ public class StringMatcher {
|
|||
return true;
|
||||
}
|
||||
/**
|
||||
* @param <code>text</code>, the string to match
|
||||
* @param <code>start</code>, the starting index in the text for search, inclusive
|
||||
* @param <code>end</code>, the stopping point of search, exclusive
|
||||
* @param code>p</code>, a string that has no wildcard
|
||||
* @param <code>ignoreCase</code>, boolean indicating wether code>p</code> is case sensitive
|
||||
* @param text the string to match
|
||||
* @param start the starting index in the text for search, inclusive
|
||||
* @param end the stopping point of search, exclusive
|
||||
* @param p a string that has no wildcard
|
||||
* @return the starting index in the text of the pattern , or -1 if not found
|
||||
*/
|
||||
protected int textPosIn(String text, int start, int end, String p) {
|
||||
|
|
|
@ -374,7 +374,6 @@ public class Strings {
|
|||
/**
|
||||
* Creates a string that consists of the given number of tab characters.
|
||||
* @param indentLevel
|
||||
* @return
|
||||
*/
|
||||
public static String createIndentString(int indentLevel) {
|
||||
StringBuffer result = new StringBuffer();
|
||||
|
|
Loading…
Add table
Reference in a new issue