Skip to content

Commit

Permalink
Code cleanup for version 0.9.8.8
Browse files Browse the repository at this point in the history
  • Loading branch information
anb0s committed Aug 7, 2011
1 parent 47c1324 commit 4fc2101
Show file tree
Hide file tree
Showing 21 changed files with 337 additions and 355 deletions.
1 change: 1 addition & 0 deletions de.anbos.eclipse.logviewer.plugin/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ Bundle-Vendor: Andre Bossert
Import-Package: org.eclipse.core.resources,
org.eclipse.ui.console
Export-Package: de.anbos.eclipse.logviewer.plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
20 changes: 4 additions & 16 deletions de.anbos.eclipse.logviewer.plugin/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,15 @@ bin.includes = plugin.xml,\
META-INF/,\
icons/,\
plugin.properties,\
bin/,\
META-INF/,\
icons/,\
plugin.properties,\
plugin.xml,\
.,\
lib/
src.includes = src/,\
plugin.xml,\
plugin.properties,\
lib/,\
build.properties,\
plugin_de.properties,\
bin/
src.includes = lib/,\
bin/,\
META-INF/,\
.settings/,\
.project,\
.classpath,\
icons/,\
LogViewerNewPreferences.jpg,\
plugin_test.xml,\
notes.txt,\
screens/
icons/
source.. = src/
bin.excludes = META-INF/MANIFEST_TEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/

package de.anbos.eclipse.logviewer.plugin;
Expand Down Expand Up @@ -56,6 +56,7 @@ public void run() {
});
}

@SuppressWarnings("rawtypes")
public Object getAdapter(Class adapter) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public class LogViewer extends ViewPart {
private TabFolder tabfolder;
private LogFileViewer viewer;

private Map logTab;
private Map<String, LogFileTab> logTab;
private TabItem oldTabItem;

private ViewDocumentListener documentListener;
Expand All @@ -117,7 +117,7 @@ public class LogViewer extends ViewPart {

public LogViewer() {
logger = LogViewerPlugin.getDefault().getLogger();
logTab = new Hashtable();
logTab = new Hashtable<String, LogFileTab>();
oldTabItem = null;
console = null;
resetMonitorCounter();
Expand Down Expand Up @@ -185,7 +185,7 @@ public void closeCurrentLogFile() {
}

public void closeAllLogFiles() {
Iterator keyIterator = logTab.keySet().iterator();
Iterator<String> keyIterator = logTab.keySet().iterator();
while(keyIterator.hasNext()) {
Object key = keyIterator.next();
LogFileTab tab = (LogFileTab)logTab.get(key);
Expand All @@ -212,7 +212,7 @@ public void refreshCurrentLogFile() {
}

public void startTailOnAllDocuments() {
Iterator keyIterator = logTab.keySet().iterator();
Iterator<String> keyIterator = logTab.keySet().iterator();
while(keyIterator.hasNext()) {
Object key = keyIterator.next();
LogFileTab tab = (LogFileTab)logTab.get(key);
Expand All @@ -223,7 +223,7 @@ public void startTailOnAllDocuments() {
}

public void stopTailOnAllDocuments() {
Iterator keyIterator = logTab.keySet().iterator();
Iterator<String> keyIterator = logTab.keySet().iterator();
while(keyIterator.hasNext()) {
Object key = keyIterator.next();
LogFileTab tab = (LogFileTab)logTab.get(key);
Expand Down Expand Up @@ -425,7 +425,8 @@ public LogFileViewer getViewer() {
* the actual viewer is returned if an adapter of type
* FindReplaceTarget is searched
*/
public Object getAdapter(Class adapter) {
@SuppressWarnings("rawtypes")
public Object getAdapter(Class adapter) {
Object object = super.getAdapter(adapter);
if(object != null) {
return object;
Expand Down Expand Up @@ -563,7 +564,7 @@ protected void showDocument(LogDocument document, ISelection sel, int index, boo

private LogFileTab getSelectedTab(TabItem item) {
if(item != null) {
for(Iterator iter = logTab.values().iterator(); iter.hasNext();) {
for(Iterator<LogFileTab> iter = logTab.values().iterator(); iter.hasNext();) {
LogFileTab logTab = (LogFileTab)iter.next();
if(logTab.getItem() == item) {
return logTab;
Expand Down Expand Up @@ -627,8 +628,8 @@ private void makeActions() {
}

private void storeAllCurrentlyOpenFiles() {
List fileList = new Vector();
Iterator keyIterator = logTab.keySet().iterator();
List<LogFile> fileList = new Vector<LogFile>();
Iterator<String> keyIterator = logTab.keySet().iterator();
while(keyIterator.hasNext()) {
Object key = keyIterator.next();
LogFileTab tab = (LogFileTab)logTab.get(key);
Expand All @@ -639,8 +640,8 @@ private void storeAllCurrentlyOpenFiles() {
}

private void openAllLastOpenFiles() {
List logFiles = PreferenceValueConverter.asLogFileList(LogViewerPlugin.getDefault().getPreferenceStore().getString(ILogViewerConstants.PREF_LAST_OPEN_FILES));
Iterator it = logFiles.iterator();
List<?> logFiles = PreferenceValueConverter.asLogFileList(LogViewerPlugin.getDefault().getPreferenceStore().getString(ILogViewerConstants.PREF_LAST_OPEN_FILES));
Iterator<?> it = logFiles.iterator();
while(it.hasNext()) {
LogFile logFile = (LogFile)it.next();
openLogFile(logFile);
Expand Down Expand Up @@ -682,7 +683,7 @@ public void documentChanged(DocumentEvent event) {
// change selection
if (event.getDocument() != tab.getDocument()) {
// show active document
Iterator keyIterator = logTab.keySet().iterator();
Iterator<String> keyIterator = logTab.keySet().iterator();
while(keyIterator.hasNext()) {
Object key = keyIterator.next();
LogFileTab newTab = (LogFileTab)logTab.get(key);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/

/*
Expand Down Expand Up @@ -57,16 +57,16 @@ static public ISelection getResourceSelection(IWorkbenchPart part) {
} catch(Exception e) {
// no op
}
}
}
}
return selection;
}

static public ISelection getConsoleSelection(IWorkbenchPart part) {
ISelection selection = null;

IConsole con = getConsole(part);

if (con != null)
selection = new StructuredSelection(con);

Expand All @@ -85,12 +85,12 @@ public static IConsole getConsole(IWorkbenchPart part) {
if (viewer == null || viewer.getDocument() == null)
return null;
}

IConsole con = null;
try {
con = ((IConsoleView)part).getConsole();
} catch (Exception e) {

}

return con;
Expand All @@ -112,9 +112,9 @@ public static ITextViewer getViewer(IPage page) {
* org.eclipse.cdt.internal.ui.buildconsole.BuildConsolePage does not
* extend TextConsolePage, so we get access to the viewer with dirty tricks
*/
Method method = page.getClass().getDeclaredMethod("getViewer", null);
Method method = page.getClass().getDeclaredMethod("getViewer", (Class<?>[])null);
method.setAccessible(true);
return (ITextViewer) method.invoke(page, null);
return (ITextViewer) method.invoke(page, (Object[])null);
} catch (Exception e) {
// AnyEditToolsPlugin.logError("Can't get page viewer from the console page", e);
}
Expand All @@ -123,7 +123,7 @@ public static ITextViewer getViewer(IPage page) {

static public File getResource(Object myObj) {
Object object = null;

if (myObj instanceof IEditorPart) {
IEditorPart editorPart = (IEditorPart)myObj;
IEditorInput input = editorPart.getEditorInput();
Expand All @@ -137,7 +137,7 @@ static public File getResource(Object myObj) {
} else {
object = input;
}
}
}
} else {
object = myObj;
}
Expand Down Expand Up @@ -177,14 +177,14 @@ static public File getResource(Object myObj) {
}
return null;
}

static public File toFile(IPath iPath)
{
{
if (iPath != null)
return iPath.toFile();
return null;
}

/*
protected File getJarFile(IAdaptable adaptable) {
JarPackageFragmentRoot jpfr = (JarPackageFragmentRoot) adaptable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/


Expand All @@ -19,30 +19,27 @@
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Shell;

import de.anbos.eclipse.logviewer.plugin.LogFile;
import de.anbos.eclipse.logviewer.plugin.LogViewer;
import de.anbos.eclipse.logviewer.plugin.LogViewerPlugin;
import de.anbos.eclipse.logviewer.plugin.LogFile.LogFileType;
import de.anbos.eclipse.logviewer.plugin.preferences.FileHistoryTracker;
import de.anbos.eclipse.logviewer.plugin.preferences.HistoryFile;

public class ClearHistoryActionDelegate implements ILogViewerActionDelegate {

// Attribute ---------------------------------------------------------------

// Constructor -------------------------------------------------------------

public ClearHistoryActionDelegate() {
}

// Public ------------------------------------------------------------------

public void run(LogViewer view, Shell shell) {
if (askClear(shell)) {
FileHistoryTracker.getInstance().clearFiles();
}
}
}

private boolean askClear(Shell shell) {
return MessageDialog.openQuestion(shell,
LogViewerPlugin.getResourceString("misc.clearhisrory.title"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public LogDocument(LogFile file, String encoding) throws SecurityException, Ille
IPreferenceStore store = LogViewerPlugin.getDefault().getPreferenceStore();
store.addPropertyChangeListener(new PropertyChangeListener());
backlogLines = store.getInt(ILogViewerConstants.PREF_BACKLOG);
setTextStore(new GapTextStore(50, 300));
setTextStore(new GapTextStore(50, 300, 1f));
setLineTracker(new DefaultLineTracker());
completeInitialization();
reader = new BackgroundReader(file.getFileType(),file.getFileName(),charset,this);
Expand Down
Loading

0 comments on commit 4fc2101

Please sign in to comment.