Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2007-11-08 19:20:00 +0000
committerslewis2007-11-08 19:20:00 +0000
commit8479ff474c212dffce2c0c7dee8250107fe799eb (patch)
tree3b6c1a8766560b1cd326d5cee6458dc5356b1fe6 /examples
parente418e64d8c9032a16f5c2419ad01268c77d19691 (diff)
downloadorg.eclipse.ecf-8479ff474c212dffce2c0c7dee8250107fe799eb.tar.gz
org.eclipse.ecf-8479ff474c212dffce2c0c7dee8250107fe799eb.tar.xz
org.eclipse.ecf-8479ff474c212dffce2c0c7dee8250107fe799eb.zip
Fix for id error and refactoring/string externalizationv20071108-1120
Diffstat (limited to 'examples')
-rw-r--r--examples/bundles/org.eclipse.ecf.example.collab/plugin.xml4
-rw-r--r--examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/share/EclipseCollabSharedObject.java1
-rw-r--r--examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/EditorCompoundContributionItem.java6
-rw-r--r--examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/Messages.java34
-rw-r--r--examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/messages.properties6
-rw-r--r--examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/ui/hyperlink/EclipseCollabHyperlink.java (renamed from examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/share/EclipseCollabHyperlink.java)9
-rw-r--r--examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/ui/hyperlink/EclipseCollabHyperlinkDetector.java (renamed from examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/share/EclipseCollabHyperlinkDetector.java)19
7 files changed, 61 insertions, 18 deletions
diff --git a/examples/bundles/org.eclipse.ecf.example.collab/plugin.xml b/examples/bundles/org.eclipse.ecf.example.collab/plugin.xml
index 02a97ad75..48a8f578e 100644
--- a/examples/bundles/org.eclipse.ecf.example.collab/plugin.xml
+++ b/examples/bundles/org.eclipse.ecf.example.collab/plugin.xml
@@ -174,8 +174,8 @@
point="org.eclipse.ui.workbench.texteditor.hyperlinkDetectors">
<hyperlinkDetector
activate="true"
- class="org.eclipse.ecf.example.collab.share.EclipseCollabHyperlinkDetector"
- id="org.eclipse.ecf.internal.irc.hyperlink.IRCHyperlinkDetector"
+ class="org.eclipse.ecf.internal.example.collab.ui.hyperlink.EclipseCollabHyperlinkDetector"
+ id="org.eclipse.ecf.internal.example.collab.ui.hyperlink.EclipseCollabHyperlinkDetector"
name="%ShareHyperlinkDetector"
targetId="org.eclipse.ui.DefaultTextEditor">
</hyperlinkDetector>
diff --git a/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/share/EclipseCollabSharedObject.java b/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/share/EclipseCollabSharedObject.java
index b32f65494..2943e1d3c 100644
--- a/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/share/EclipseCollabSharedObject.java
+++ b/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/share/EclipseCollabSharedObject.java
@@ -37,6 +37,7 @@ import org.eclipse.ecf.internal.example.collab.ui.ImageWrapper;
import org.eclipse.ecf.internal.example.collab.ui.LineChatClientView;
import org.eclipse.ecf.internal.example.collab.ui.LineChatHandler;
import org.eclipse.ecf.internal.example.collab.ui.LineChatView;
+import org.eclipse.ecf.internal.example.collab.ui.hyperlink.EclipseCollabHyperlinkDetector;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.events.DisposeEvent;
diff --git a/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/EditorCompoundContributionItem.java b/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/EditorCompoundContributionItem.java
index 7246e535c..e02523722 100644
--- a/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/EditorCompoundContributionItem.java
+++ b/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/EditorCompoundContributionItem.java
@@ -68,17 +68,17 @@ public class EditorCompoundContributionItem extends CompoundContributionItem {
public void run() {
final ClientEntry entry = isConnected(project.getWorkspace().getRoot());
if (entry == null) {
- MessageDialog.openInformation(getWorkbench().getDisplay().getActiveShell(), "Not Connected to Collaboration Session", "Not connected to any collaboration group. To connect, open Collaboration View");
+ MessageDialog.openInformation(getWorkbench().getDisplay().getActiveShell(), Messages.EditorCompoundContributionItem_EXCEPTION_NOT_CONNECTED_TITLE, Messages.EditorCompoundContributionItem_EXCEPTION_NOT_CONNECTED_MESSAGE);
return;
}
final EclipseCollabSharedObject collabsharedobject = entry.getSharedObject();
if (collabsharedobject != null) {
- collabsharedobject.sendOpenAndSelectForFile(null, project.getName() + "/" + file.getProjectRelativePath().toString(), textSelection.getOffset(), textSelection.getLength());
+ collabsharedobject.sendOpenAndSelectForFile(null, project.getName() + "/" + file.getProjectRelativePath().toString(), textSelection.getOffset(), textSelection.getLength()); //$NON-NLS-1$
}
}
};
- action.setText("Share Selection");
+ action.setText(Messages.EditorCompoundContributionItem_SHARE_SELECTION_MENU_ITEM_NAME);
//action.setAccelerator(SWT.CTRL | SWT.SHIFT | '1');
return new IContributionItem[] {new Separator(), new ActionContributionItem(action)};
}
diff --git a/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/Messages.java b/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/Messages.java
new file mode 100644
index 000000000..7c20820e4
--- /dev/null
+++ b/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/Messages.java
@@ -0,0 +1,34 @@
+/****************************************************************************
+ * Copyright (c) 2007 Composent, Inc. 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:
+ * Composent, Inc. - initial API and implementation
+ *****************************************************************************/
+
+package org.eclipse.ecf.internal.example.collab;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ *
+ */
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.ecf.internal.example.collab.messages"; //$NON-NLS-1$
+ public static String EclipseCollabHyperlink_EXCEPTION_OPEN_EDITOR;
+ public static String EclipseCollabHyperlink_EXCEPTION_OPEN_EDITOR_TITLE;
+ public static String EclipseCollabHyperlink_MESSAGE_EXCEPTION_OPEN_EDITOR;
+ public static String EditorCompoundContributionItem_EXCEPTION_NOT_CONNECTED_MESSAGE;
+ public static String EditorCompoundContributionItem_EXCEPTION_NOT_CONNECTED_TITLE;
+ public static String EditorCompoundContributionItem_SHARE_SELECTION_MENU_ITEM_NAME;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/messages.properties b/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/messages.properties
new file mode 100644
index 000000000..ffeaaa52a
--- /dev/null
+++ b/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/messages.properties
@@ -0,0 +1,6 @@
+EclipseCollabHyperlink_EXCEPTION_OPEN_EDITOR=Exception in openEditorAndSelectForFile
+EclipseCollabHyperlink_EXCEPTION_OPEN_EDITOR_TITLE=Open Editor Failed
+EclipseCollabHyperlink_MESSAGE_EXCEPTION_OPEN_EDITOR=Cannot open editor for {0}. It was not found in your workspace.
+EditorCompoundContributionItem_EXCEPTION_NOT_CONNECTED_MESSAGE=Not connected to any collaboration group. To connect, open Collaboration View
+EditorCompoundContributionItem_EXCEPTION_NOT_CONNECTED_TITLE=Not Connected to Collaboration Session
+EditorCompoundContributionItem_SHARE_SELECTION_MENU_ITEM_NAME=Share Selection
diff --git a/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/share/EclipseCollabHyperlink.java b/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/ui/hyperlink/EclipseCollabHyperlink.java
index 3a35c167f..8a54f675c 100644
--- a/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/share/EclipseCollabHyperlink.java
+++ b/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/ui/hyperlink/EclipseCollabHyperlink.java
@@ -9,14 +9,15 @@
* Composent, Inc. - initial API and implementation
*****************************************************************************/
-package org.eclipse.ecf.example.collab.share;
+package org.eclipse.ecf.internal.example.collab.ui.hyperlink;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Path;
-import org.eclipse.ecf.example.collab.share.EclipseCollabHyperlinkDetector.Selection;
import org.eclipse.ecf.internal.example.collab.ClientPlugin;
+import org.eclipse.ecf.internal.example.collab.Messages;
import org.eclipse.ecf.internal.example.collab.ui.EditorHelper;
+import org.eclipse.ecf.internal.example.collab.ui.hyperlink.EclipseCollabHyperlinkDetector.Selection;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.hyperlink.IHyperlink;
@@ -80,10 +81,10 @@ public class EclipseCollabHyperlink implements IHyperlink {
try {
eh.openAndSelectForFile(file, (selection == null) ? 0 : selection.getStart(), (selection == null) ? 0 : (selection.getEnd() - selection.getStart()));
} catch (final Exception e) {
- ClientPlugin.log("Exception in openEditorAndSelectForFile", e);
+ ClientPlugin.log(Messages.EclipseCollabHyperlink_EXCEPTION_OPEN_EDITOR, e);
}
} else {
- MessageDialog.openInformation(ww.getShell(), "Open Editor Failed", NLS.bind("Cannot open editor for {0}. It was not found in your workspace.", fileName));
+ MessageDialog.openInformation(ww.getShell(), Messages.EclipseCollabHyperlink_EXCEPTION_OPEN_EDITOR_TITLE, NLS.bind(Messages.EclipseCollabHyperlink_MESSAGE_EXCEPTION_OPEN_EDITOR, fileName));
}
}
diff --git a/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/share/EclipseCollabHyperlinkDetector.java b/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/ui/hyperlink/EclipseCollabHyperlinkDetector.java
index 2ac8499e3..a854367c3 100644
--- a/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/share/EclipseCollabHyperlinkDetector.java
+++ b/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/ui/hyperlink/EclipseCollabHyperlinkDetector.java
@@ -8,8 +8,9 @@
* Contributors:
* Composent, Inc. - initial API and implementation
*****************************************************************************/
-package org.eclipse.ecf.example.collab.share;
+package org.eclipse.ecf.internal.example.collab.ui.hyperlink;
+import org.eclipse.ecf.example.collab.share.EclipseCollabSharedObject;
import org.eclipse.ecf.example.collab.share.EclipseCollabSharedObject.SharedMarker;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
@@ -21,9 +22,9 @@ import org.eclipse.jface.text.hyperlink.IHyperlink;
public class EclipseCollabHyperlinkDetector extends AbstractHyperlinkDetector {
- public static final String SHARE_FILE_HYPERLINK_END = "/>";
- public static final String SHARE_FILE_HYPERLINK_START = "<open file=\"";
- public static final String SHARE_FILE_HYPERLINK_SELECTION = " selection=";
+ public static final String SHARE_FILE_HYPERLINK_END = "/>"; //$NON-NLS-1$
+ public static final String SHARE_FILE_HYPERLINK_START = "<open file=\""; //$NON-NLS-1$
+ public static final String SHARE_FILE_HYPERLINK_SELECTION = " selection="; //$NON-NLS-1$
/* (non-Javadoc)
* @see org.eclipse.jface.text.hyperlink.IHyperlinkDetector#detectHyperlinks(org.eclipse.jface.text.ITextViewer, org.eclipse.jface.text.IRegion, boolean)
@@ -77,7 +78,7 @@ public class EclipseCollabHyperlinkDetector extends AbstractHyperlinkDetector {
return null;
// should have syntax start-end
final String selection = linkString.substring(beginIndex + SHARE_FILE_HYPERLINK_SELECTION.length(), endIndex);
- final int dashIndex = selection.indexOf("-");
+ final int dashIndex = selection.indexOf("-"); //$NON-NLS-1$
if (dashIndex == -1)
return null;
try {
@@ -112,10 +113,10 @@ public class EclipseCollabHyperlinkDetector extends AbstractHyperlinkDetector {
* @return
*/
private String detectFileName(String substring) {
- final int startIndex = substring.indexOf("\"");
+ final int startIndex = substring.indexOf("\""); //$NON-NLS-1$
if (startIndex == -1)
return null;
- final int endIndex = substring.indexOf("\"", startIndex + 1);
+ final int endIndex = substring.indexOf("\"", startIndex + 1); //$NON-NLS-1$
if (endIndex == -1)
return null;
return substring.substring(startIndex + 1, endIndex);
@@ -134,13 +135,13 @@ public class EclipseCollabHyperlinkDetector extends AbstractHyperlinkDetector {
public static String createDisplayStringForEditorOpen(String resourceName, SharedMarker marker) {
final StringBuffer se = new StringBuffer(EclipseCollabHyperlinkDetector.SHARE_FILE_HYPERLINK_START);
- se.append(resourceName).append("\"");
+ se.append(resourceName).append("\""); //$NON-NLS-1$
if (marker != null) {
final int start = marker.getOffset().intValue();
final int length = marker.getLength().intValue();
if (length > 0) {
se.append(EclipseCollabHyperlinkDetector.SHARE_FILE_HYPERLINK_SELECTION);
- se.append(start).append("-").append(start + length);
+ se.append(start).append("-").append(start + length); //$NON-NLS-1$
}
}
se.append(EclipseCollabHyperlinkDetector.SHARE_FILE_HYPERLINK_END);

Back to the top