Skip to content

Commit

Permalink
updated file headers for this PR and fixed some warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Andre Bossert <[email protected]>
  • Loading branch information
anb0s committed Jan 29, 2018
1 parent 41c5cc8 commit 9a87274
Show file tree
Hide file tree
Showing 12 changed files with 274 additions and 266 deletions.
1 change: 0 additions & 1 deletion de.anbos.eclipse.logviewer.plugin/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ bin.includes = plugin.xml,\
plugin_de.properties,\
target/logviewer-lib.jar
src.includes = lib/,\
bin/,\
icons/
source.target/logviewer-lib.jar = src/
Original file line number Diff line number Diff line change
@@ -1,71 +1,71 @@
/*
* Copyright 2009, 2010 by Andre Bossert
* 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.
*/

package de.anbos.eclipse.logviewer.plugin;

import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.console.IConsole;
import org.eclipse.ui.console.IConsoleConstants;
import org.eclipse.ui.console.IConsolePageParticipant;
import org.eclipse.ui.part.IPageBookViewPage;

import de.anbos.eclipse.logviewer.plugin.action.ConsoleOpenAction;

public class ConsolePageParticipant implements IConsolePageParticipant {

private IPageBookViewPage page;

public void activated() {
// no op
}

public void deactivated() {
// no op
}

public void dispose() {
page = null;
}

public void init(IPageBookViewPage myPage, IConsole console) {
page = myPage;
IToolBarManager toolBarManager = page.getSite().getActionBars()
.getToolBarManager();
toolBarManager.appendToGroup(IConsoleConstants.OUTPUT_GROUP, new Separator());
toolBarManager.appendToGroup(IConsoleConstants.OUTPUT_GROUP, new Action(
LogViewerPlugin.getResourceString("logviewer.action.openwith.name"),
UIImages.getImageDescriptor(ILogViewerConstants.IMG_LOG_VIEWER)) {
public void run() {
ConsolePageParticipant.this.run();
}
});
}

@SuppressWarnings("rawtypes")
public Object getAdapter(Class adapter) {
return null;
}

private void run() {
IWorkbenchPart part = page.getSite().getWorkbenchWindow().getActivePage().getActivePart();
ConsoleOpenAction action = EditorPropertyTester.hasAbstractConsole(part);
if (action != null)
action.run(null);
}

}
/*
* Copyright 2009, 2010 by Andre Bossert
* 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.
*/

package de.anbos.eclipse.logviewer.plugin;

import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.console.IConsole;
import org.eclipse.ui.console.IConsoleConstants;
import org.eclipse.ui.console.IConsolePageParticipant;
import org.eclipse.ui.part.IPageBookViewPage;

import de.anbos.eclipse.logviewer.plugin.action.ConsoleOpenAction;

public class ConsolePageParticipant implements IConsolePageParticipant {

private IPageBookViewPage page;

public void activated() {
// no op
}

public void deactivated() {
// no op
}

public void dispose() {
page = null;
}

public void init(IPageBookViewPage myPage, IConsole console) {
page = myPage;
IToolBarManager toolBarManager = page.getSite().getActionBars()
.getToolBarManager();
toolBarManager.appendToGroup(IConsoleConstants.OUTPUT_GROUP, new Separator());
toolBarManager.appendToGroup(IConsoleConstants.OUTPUT_GROUP, new Action(
LogViewerPlugin.getResourceString("logviewer.action.openwith.name"),
UIImages.getImageDescriptor(ILogViewerConstants.IMG_LOG_VIEWER)) {
public void run() {
ConsolePageParticipant.this.run();
}
});
}

@SuppressWarnings({ "rawtypes", "unchecked" })
public Object getAdapter(Class adapter) {
return null;
}

private void run() {
IWorkbenchPart part = page.getSite().getWorkbenchWindow().getActivePage().getActivePart();
ConsoleOpenAction action = EditorPropertyTester.hasAbstractConsole(part);
if (action != null)
action.run(null);
}

}
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@

package de.anbos.eclipse.logviewer.plugin;

/*
/*******************************************************************************
* Copyright (c) 2007 - 2011 by Michael Mimo Moratti
* Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (c) 2012 - 2018 by Andre Bossert
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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
* http://www.eclipse.org/legal/epl-v10.html
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an &quot;AS IS&quot; 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.
*/
* Contributors:
* Michael Mimo Moratti - initial API and implementation and/or initial documentation
* Andre Bossert - extensions
* Artur Wozniak - clear file
*
*******************************************************************************/

package de.anbos.eclipse.logviewer.plugin;

public interface ILogViewerConstants {

// FileTail settings -----------------------------------------------------------

public static final long TAIL_FILEOPEN_ERROR_WAIT = 500;

// Images ------------------------------------------------------------------

public static final String IMG_OPEN_FILE_ACTIVE = "IMG_OPEN_FILE_ACTIVE"; //$NON-NLS-1$
public static final String IMG_OPEN_FILE_PASSIVE = "IMG_OPEN_FILE_PASSIVE"; //$NON-NLS-1$
public static final String IMG_CLEAR_HISTORY_ACTIVE = "IMG_CLEAR_HISTORY_ACTIVE"; //$NON-NLS-1$
Expand Down Expand Up @@ -56,36 +56,36 @@ public interface ILogViewerConstants {
public static final String IMG_LOG_VIEWER = "IMG_LOG_VIEWER";
public static final String IMG_FILE_CLEAR_ACTIVE = "IMG_CLEAR_ACTIVE"; //$NON-NLS-1$
public static final String IMG_FILE_CLEAR_PASSIVE = "IMG_CLEAR_PASSIVE"; //$NON-NLS-1$

// Preferences -------------------------------------------------------------

/* defines the maximal amount of rows that are backloged */
public static final int MAX_BACKLOG = 200000;
public static final int DEFAULT_BACKLOG = 4000;
public static final String PREF_BACKLOG = "BACKLOG"; //$NON-NLS-1$

public static final int MAX_TAIL_BUFFER_SIZE = 4096;
public static final int DEFAULT_BUFFER_CAPACITY = 1024;
public static final String PREF_BUFFER = "BUFFER"; //$NON-NLS-1$

public static final int MAX_READWAIT_SIZE = 1000000;
public static final int DEFAULT_READWAIT_SIZE = 250;
public static final String PREF_READWAIT = "READWAIT"; //$NON-NLS-1$

public static final String PREF_ENCODING = "ENCODING"; //$NON-NLS-1$

public static final String PREF_CURSORLINE_COLOR = "CURSOR_LINE_COLOR"; //$NON-NLS-1$

public static final String PREF_EDITOR_FONT_STYLE = "EDITOR_FONT_SYLE"; //$NON-NLS-1$

public static final String PREF_COLORING_ITEMS = "ITEM_COLORING"; //$NON-NLS-1$

public static final String PREF_LAST_OPEN_FILES = "LAST_OPEN_FILES"; //$NON-NLS-1$

/* defines the maximum amount of files in the drop down history */
public static final int MAX_FILES_IN_HISTORY = 10;
public static final String PREF_HISTORY_FILES = "HISTORY_FILES"; //$NON-NLS-1$

/* word wrap */
public static boolean DEAFULT_WORD_WRAP = false;
public static final String PREF_WORD_WRAP = "WORD_WRAP"; //$NON-NLS-1$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
* Contributors:
* Michael Mimo Moratti - initial API and implementation and/or initial documentation
* Andre Bossert - extensions
* Artur Wozniak - clear file
*
*******************************************************************************/

package de.anbos.eclipse.logviewer.plugin;
Expand Down Expand Up @@ -178,7 +180,7 @@ public void closeCurrentLogFile() {
} catch(IOException e) {
logger.logError("unable to remove the current; active tab"); //$NON-NLS-1$
}

int index = tabfolder.getSelectionIndex();
getSelectedItem().dispose();
if (!greyAllOutIfNoFiles()) {
Expand Down Expand Up @@ -225,7 +227,7 @@ public void closeAllLogFiles() {
Iterator<String> keyIterator = logTab.keySet().iterator();
while(keyIterator.hasNext()) {
Object key = keyIterator.next();
LogFileTab tab = (LogFileTab)logTab.get(key);
LogFileTab tab = logTab.get(key);
try {
tab.close();
tab.getItem().dispose();
Expand All @@ -252,7 +254,7 @@ public void startTailOnAllDocuments() {
Iterator<String> keyIterator = logTab.keySet().iterator();
while(keyIterator.hasNext()) {
Object key = keyIterator.next();
LogFileTab tab = (LogFileTab)logTab.get(key);
LogFileTab tab = logTab.get(key);
tab.getDocument().setMonitor(true);
}
setMonitorCounterToMax();
Expand All @@ -263,7 +265,7 @@ public void stopTailOnAllDocuments() {
Iterator<String> keyIterator = logTab.keySet().iterator();
while(keyIterator.hasNext()) {
Object key = keyIterator.next();
LogFileTab tab = (LogFileTab)logTab.get(key);
LogFileTab tab = logTab.get(key);
tab.getDocument().setMonitor(false);

}
Expand Down Expand Up @@ -393,7 +395,7 @@ public void openLogFile(LogFile file) {
if (file.getNamePattern().equals(LogViewerPlugin.getResourceString("logviewer.plugin.console.name"))) {
createConsole();
}

String encoding = LogViewerPlugin.getDefault().getPreferenceStore().getString(ILogViewerConstants.PREF_ENCODING);
LogDocument document = new LogDocument(file,encoding);
TabItem item = new TabItem(tabfolder,0);
Expand Down Expand Up @@ -424,7 +426,7 @@ public void openLogFile(LogFile file) {
}
}
// show active document
LogFileTab tab = (LogFileTab)logTab.get(key);
LogFileTab tab = logTab.get(key);
try {
showDocument(tab.getDocument(),null,0,true);
tabfolder.setSelection(new TabItem[] {tab.getItem()});
Expand Down Expand Up @@ -466,7 +468,7 @@ public LogFileViewer getViewer() {
* the actual viewer is returned if an adapter of type
* FindReplaceTarget is searched
*/
@SuppressWarnings("rawtypes")
@SuppressWarnings({ "rawtypes", "unchecked" })
public Object getAdapter(Class adapter) {
Object object = super.getAdapter(adapter);
if(object != null) {
Expand All @@ -490,7 +492,7 @@ public void setCurrentLogFileTabName(String name) {
public String getCurrentLogFilePath() {
return getSelectedTab().getDocument().getFile().getPath();
}

public void dispose() {
viewer.removeListeners();
storeAllCurrentlyOpenFiles();
Expand Down Expand Up @@ -612,7 +614,7 @@ protected void showDocument(LogDocument document, ISelection sel, int index, boo
private LogFileTab getSelectedTab(TabItem item) {
if(item != null) {
for(Iterator<LogFileTab> iter = logTab.values().iterator(); iter.hasNext();) {
LogFileTab logTab = (LogFileTab)iter.next();
LogFileTab logTab = iter.next();
if(logTab.getItem() == item) {
return logTab;
}
Expand Down Expand Up @@ -682,7 +684,7 @@ private void storeAllCurrentlyOpenFiles() {
Iterator<String> keyIterator = logTab.keySet().iterator();
while(keyIterator.hasNext()) {
Object key = keyIterator.next();
LogFileTab tab = (LogFileTab)logTab.get(key);
LogFileTab tab = logTab.get(key);
LogFile logFile = tab.getDocument().getFile();
fileList.add(logFile);
}
Expand Down Expand Up @@ -736,7 +738,7 @@ public void documentChanged(DocumentEvent event) {
Iterator<String> keyIterator = logTab.keySet().iterator();
while(keyIterator.hasNext()) {
Object key = keyIterator.next();
LogFileTab newTab = (LogFileTab)logTab.get(key);
LogFileTab newTab = logTab.get(key);
if (event.getDocument() == newTab.getDocument()) {
showDocument(newTab.getDocument(),null,0,true);
tabfolder.setSelection(new TabItem[] {newTab.getItem()});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Copyright (c) 2007 - 2009 by Michael Mimo Moratti
# Copyright (c) 2010 - 2011 by Andre Bossert
# Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
# 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
# Copyright (c) 2007 - 2011 by Michael Mimo Moratti
# Copyright (c) 2012 - 2018 by Andre Bossert
#
# 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
# http://www.eclipse.org/legal/epl-v10.html
#
# Contributors:
# Michael Mimo Moratti - initial API and implementation and/or initial documentation
# Andre Bossert - extensions
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an &quot;AS IS&quot; 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.

# see plugin.properties
logviewer.action.openwith.name=Open with LogViewer
Expand Down
Loading

0 comments on commit 9a87274

Please sign in to comment.