Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2008-04-02 05:56:27 +0000
committerslewis2008-04-02 05:56:27 +0000
commit68e4219ceb8960488e11be009ebb92ebdf38db6f (patch)
tree37ee59d51d5741998ea9745c12b8af86adfe2611 /providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org
parente73534827fe3266a0549a835465b9e4f23f77326 (diff)
downloadorg.eclipse.ecf-68e4219ceb8960488e11be009ebb92ebdf38db6f.tar.gz
org.eclipse.ecf-68e4219ceb8960488e11be009ebb92ebdf38db6f.tar.xz
org.eclipse.ecf-68e4219ceb8960488e11be009ebb92ebdf38db6f.zip
Added copyright for contribution from Abner Ballardo in bug 197745
Diffstat (limited to 'providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org')
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/hyperlink/IRCChannelHyperlink.java21
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/hyperlink/IRCChannelHyperlinkDetector.java53
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/hyperlink/IRCHyperlinkDetector.java18
3 files changed, 55 insertions, 37 deletions
diff --git a/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/hyperlink/IRCChannelHyperlink.java b/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/hyperlink/IRCChannelHyperlink.java
index b9a325121..34d584a7e 100644
--- a/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/hyperlink/IRCChannelHyperlink.java
+++ b/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/hyperlink/IRCChannelHyperlink.java
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Abner Ballardo and others.
+ * 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:
+ * Abner Ballardo <modlost@modlost.net> - initial API and implementation via bug 197745
+ ******************************************************************************/
package org.eclipse.ecf.internal.irc.ui.hyperlink;
import org.eclipse.ecf.presence.chatroom.IChatRoomManager;
@@ -7,18 +17,17 @@ import org.eclipse.jface.text.Region;
import org.eclipse.jface.text.hyperlink.IHyperlink;
public class IRCChannelHyperlink implements IHyperlink {
- private Region region;
+ private final Region region;
- private String channel;
+ private final String channel;
private String typeLabel;
private String hyperlinkText;
- private ChatRoomManagerView view;
+ private final ChatRoomManagerView view;
- public IRCChannelHyperlink(ChatRoomManagerView view, String channel,
- Region region) {
+ public IRCChannelHyperlink(ChatRoomManagerView view, String channel, Region region) {
this.channel = channel;
this.region = region;
this.view = view;
@@ -37,7 +46,7 @@ public class IRCChannelHyperlink implements IHyperlink {
}
public void open() {
- IChatRoomManager manager = (IChatRoomManager) view.getRootChatRoomContainer();
+ final IChatRoomManager manager = (IChatRoomManager) view.getRootChatRoomContainer();
view.joinRoom(manager.getChatRoomInfo(channel), "");
}
diff --git a/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/hyperlink/IRCChannelHyperlinkDetector.java b/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/hyperlink/IRCChannelHyperlinkDetector.java
index f86f479ea..5e805c476 100644
--- a/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/hyperlink/IRCChannelHyperlinkDetector.java
+++ b/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/hyperlink/IRCChannelHyperlinkDetector.java
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Abner Ballardo and others.
+ * 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:
+ * Abner Ballardo <modlost@modlost.net> - initial API and implementation via bug 197745
+ ******************************************************************************/
package org.eclipse.ecf.internal.irc.ui.hyperlink;
import java.util.StringTokenizer;
@@ -10,8 +20,7 @@ import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.Region;
import org.eclipse.jface.text.hyperlink.IHyperlink;
-public class IRCChannelHyperlinkDetector extends
- org.eclipse.jface.text.hyperlink.AbstractHyperlinkDetector {
+public class IRCChannelHyperlinkDetector extends org.eclipse.jface.text.hyperlink.AbstractHyperlinkDetector {
public static final String DEFAULT_PREFIX = "#"; //$NON-NLS-1$
public static final String DEFAULT_ENDDELIMITERS = " \t\n\r\f<>"; //$NON-NLS-1$
@@ -21,61 +30,52 @@ public class IRCChannelHyperlinkDetector extends
* @see org.eclipse.jface.text.hyperlink.IHyperlinkDetector#detectHyperlinks(org.eclipse.jface.text.ITextViewer,
* org.eclipse.jface.text.IRegion, boolean)
*/
- public IHyperlink[] detectHyperlinks(ITextViewer textViewer,
- IRegion region, boolean canShowMultipleHyperlinks) {
+ public IHyperlink[] detectHyperlinks(ITextViewer textViewer, IRegion region, boolean canShowMultipleHyperlinks) {
if (region == null || textViewer == null)
return null;
- ChatRoomManagerView view = (ChatRoomManagerView) getAdapter(ChatRoomManagerView.class);
+ final ChatRoomManagerView view = (ChatRoomManagerView) getAdapter(ChatRoomManagerView.class);
- IDocument document = textViewer.getDocument();
+ final IDocument document = textViewer.getDocument();
if (document == null)
return null;
- int offset = region.getOffset();
+ final int offset = region.getOffset();
IRegion lineInfo;
String line;
try {
lineInfo = document.getLineInformationOfOffset(offset);
line = document.get(lineInfo.getOffset(), lineInfo.getLength());
- } catch (BadLocationException ex) {
+ } catch (final BadLocationException ex) {
return null;
}
- Region detectedRegion = detectRegion(lineInfo, line, offset
- - lineInfo.getOffset());
+ final Region detectedRegion = detectRegion(lineInfo, line, offset - lineInfo.getOffset());
if (detectedRegion == null)
return null;
- int detectedOffset = detectedRegion.getOffset() - lineInfo.getOffset();
+ final int detectedOffset = detectedRegion.getOffset() - lineInfo.getOffset();
- return createHyperLinksForChannel(view, line.substring(detectedOffset,
- detectedOffset + detectedRegion.getLength()), detectedRegion);
+ return createHyperLinksForChannel(view, line.substring(detectedOffset, detectedOffset + detectedRegion.getLength()), detectedRegion);
}
- private Region detectRegion(IRegion lineInfo, String fromLine,
- int offsetInLine) {
+ private Region detectRegion(IRegion lineInfo, String fromLine, int offsetInLine) {
int resultLength = 0;
int separatorOffset = fromLine.indexOf(DEFAULT_PREFIX);
while (separatorOffset >= 0) {
- StringTokenizer tokenizer = new StringTokenizer(fromLine
- .substring(separatorOffset + DEFAULT_PREFIX.length()),
- DEFAULT_ENDDELIMITERS, false);
+ final StringTokenizer tokenizer = new StringTokenizer(fromLine.substring(separatorOffset + DEFAULT_PREFIX.length()), DEFAULT_ENDDELIMITERS, false);
if (!tokenizer.hasMoreTokens())
return null;
- resultLength = tokenizer.nextToken().length()
- + DEFAULT_PREFIX.length();
- if (offsetInLine >= separatorOffset
- && offsetInLine <= separatorOffset + resultLength)
+ resultLength = tokenizer.nextToken().length() + DEFAULT_PREFIX.length();
+ if (offsetInLine >= separatorOffset && offsetInLine <= separatorOffset + resultLength)
break;
- separatorOffset = fromLine.indexOf(DEFAULT_PREFIX,
- separatorOffset + 1);
+ separatorOffset = fromLine.indexOf(DEFAULT_PREFIX, separatorOffset + 1);
}
if (separatorOffset < 0)
@@ -84,8 +84,7 @@ public class IRCChannelHyperlinkDetector extends
return new Region(lineInfo.getOffset() + separatorOffset, resultLength);
}
- private IHyperlink[] createHyperLinksForChannel(ChatRoomManagerView view,
- String channel, Region region) {
- return new IHyperlink[] { new IRCChannelHyperlink(view, channel, region) };
+ private IHyperlink[] createHyperLinksForChannel(ChatRoomManagerView view, String channel, Region region) {
+ return new IHyperlink[] {new IRCChannelHyperlink(view, channel, region)};
}
}
diff --git a/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/hyperlink/IRCHyperlinkDetector.java b/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/hyperlink/IRCHyperlinkDetector.java
index 9d344e5a2..0b75e923e 100644
--- a/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/hyperlink/IRCHyperlinkDetector.java
+++ b/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/hyperlink/IRCHyperlinkDetector.java
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Abner Ballardo and others.
+ * 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:
+ * Abner Ballardo <modlost@modlost.net> - initial API and implementation via bug 197745
+ ******************************************************************************/
package org.eclipse.ecf.internal.irc.ui.hyperlink;
import java.net.URI;
@@ -9,16 +19,16 @@ import org.eclipse.jface.text.hyperlink.IHyperlink;
public class IRCHyperlinkDetector extends AbstractURLHyperlinkDetector {
public static final String IRC_PROTOCOL = "irc"; //$NON-NLS-1$
-
+
public IRCHyperlinkDetector() {
- setProtocols(new String [] { IRC_PROTOCOL });
+ setProtocols(new String[] {IRC_PROTOCOL});
}
/* (non-Javadoc)
* @see org.eclipse.ecf.ui.hyperlink.AbstractURLHyperlinkDetector#createHyperLinksForURI(org.eclipse.jface.text.IRegion, java.net.URI)
*/
protected IHyperlink[] createHyperLinksForURI(IRegion region, URI uri) {
- return new IHyperlink[] { new IRCHyperlink(region, uri) };
- }
+ return new IHyperlink[] {new IRCHyperlink(region, uri)};
+ }
}

Back to the top