Skip to content

Commit e322a43

Browse files
committed
The first commit.
0 parents  commit e322a43

30 files changed

+5023
-0
lines changed

Diff for: .classpath

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
4+
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
5+
<classpathentry kind="src" path="src"/>
6+
<classpathentry kind="output" path="bin"/>
7+
</classpath>

Diff for: .gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.project
2+
.settings
3+
bin

Diff for: META-INF/MANIFEST.MF

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Manifest-Version: 1.0
2+
Bundle-ManifestVersion: 2
3+
Bundle-Name: %plugin.name
4+
Bundle-SymbolicName: jp.codic.cep.core;singleton:=true
5+
Bundle-Version: 1.0.1.qualifier
6+
Bundle-Activator: jp.codic.plugins.eclipse.CodicPlugin
7+
Require-Bundle: org.eclipse.ui,
8+
org.eclipse.core.runtime,
9+
org.eclipse.jface.text,
10+
org.eclipse.core.resources,
11+
org.eclipse.jdt.ui,
12+
org.eclipse.ui.ide,
13+
org.eclipse.jdt.core
14+
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
15+
Import-Package: org.eclipse.ui.texteditor
16+
Bundle-Vendor: %plugin.vendor
17+
Bundle-ActivationPolicy: lazy

Diff for: OSGI-INF/l10n/bundle.properties

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
plugin.name = Codic plugin
2+
plugin.vendor = Codic project team
3+
menu.label = Codic
4+
category.name = Codic
5+
command.name = Quicklook
6+
view.name =
7+
page.name = Codic
8+
Bundle-Name = CodicPlugin

Diff for: OSGI-INF/l10n/bundle_ja.properties

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
plugin.name = Codic \u30D7\u30E9\u30B0\u30A4\u30F3
2+
plugin.vendor = Codic project team
3+
menu.label = Codic
4+
category.name = Codic
5+
command.name = \u30AF\u30A4\u30C3\u30AF\u8F9E\u66F8\u691C\u7D22
6+
view.name =
7+
page.name = Codic
8+
Bundle-Name = CodicPlugin

Diff for: build.properties

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
source.. = src/
2+
output.. = bin/
3+
bin.includes = plugin.xml,\
4+
META-INF/,\
5+
.,\
6+
icons/,\
7+
OSGI-INF/
8+

Diff for: icons/font.gif

112 Bytes
Loading

Diff for: icons/sample.gif

983 Bytes
Loading

Diff for: plugin.xml

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<?eclipse version="3.4"?>
3+
<plugin>
4+
5+
<extension point="org.eclipse.ui.commands">
6+
<category
7+
name="%category.name"
8+
id="jp.codic.cep.commands.category">
9+
</category>
10+
<command
11+
name="%command.name"
12+
categoryId="jp.codic.cep.commands.category"
13+
id="jp.codic.cep.commands.quicklook">
14+
</command>
15+
</extension>
16+
17+
<extension point="org.eclipse.ui.handlers">
18+
<handler
19+
commandId="jp.codic.cep.commands.quicklook"
20+
class="jp.codic.plugins.eclipse.handlers.QuicklookHandler">
21+
</handler>
22+
</extension>
23+
24+
<extension point="org.eclipse.ui.menus">
25+
<!-- main menu -->
26+
<menuContribution
27+
locationURI="menu:edit?after=additions">
28+
<menu label="%menu.label">
29+
<command commandId="jp.codic.cep.commands.quicklook"
30+
id="jp.codic.cep.menus.quicklook.menu">
31+
</command>
32+
</menu>
33+
</menuContribution>
34+
35+
<!-- Context menu
36+
See: https://wiki.eclipse.org/Menu_Contributions/TextEditor_viewerContribution-->
37+
<menuContribution
38+
locationURI="popup:org.eclipse.ui.popup.any?after=additions">
39+
<menu label="%menu.label">
40+
<command
41+
commandId="jp.codic.cep.commands.quicklook"
42+
id="jp.codic.cep.menus.quicklook.contextMenu">
43+
44+
<!--
45+
<with variable="activeEditor">
46+
<test
47+
forcePluginActivation="true"
48+
property="jp.codic.cep.isEditor" />
49+
</with>
50+
-->
51+
<visibleWhen>
52+
<with variable="selection">
53+
<instanceof value="org.eclipse.jface.text.ITextSelection"/>
54+
</with>
55+
</visibleWhen>
56+
57+
</command>
58+
</menu>
59+
</menuContribution>
60+
61+
</extension>
62+
<!-- commands and their bindings
63+
NOTE:
64+
M1 = CTRL/COMMAND
65+
M2 = SHIFT
66+
M3 = ALT
67+
M4 = Platform-specific fourth key
68+
-->
69+
<extension
70+
point="org.eclipse.ui.bindings">
71+
<key sequence="M1+M2+D"
72+
commandId="jp.codic.cep.commands.quicklook"
73+
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
74+
contextId="org.eclipse.ui.contexts.window"
75+
/>
76+
</extension>
77+
78+
<extension
79+
point="org.eclipse.ui.propertyPages">
80+
<page
81+
class="jp.codic.plugins.eclipse.propertyPages.ProjectPropertyPage"
82+
id="jp.codic.cep.property.page"
83+
name="%page.name">
84+
<enabledWhen>
85+
<or>
86+
<instanceof value="org.eclipse.core.resources.IProject"></instanceof>
87+
<instanceof value="org.eclipse.jdt.core.IJavaProject"></instanceof>
88+
</or>
89+
</enabledWhen>
90+
</page>
91+
</extension>
92+
93+
</plugin>

Diff for: src/jp/codic/plugins/eclipse/CodicPlugin.java

+132
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
package jp.codic.plugins.eclipse;
2+
3+
import org.eclipse.core.resources.IFile;
4+
import org.eclipse.core.resources.IProject;
5+
import org.eclipse.jface.resource.ImageDescriptor;
6+
import org.eclipse.jface.resource.ImageRegistry;
7+
import org.eclipse.osgi.util.NLS;
8+
import org.eclipse.ui.IEditorInput;
9+
import org.eclipse.ui.IEditorPart;
10+
import org.eclipse.ui.IFileEditorInput;
11+
import org.eclipse.ui.IWorkbenchPage;
12+
import org.eclipse.ui.IWorkbenchWindow;
13+
import org.eclipse.ui.PartInitException;
14+
import org.eclipse.ui.PlatformUI;
15+
import org.eclipse.ui.part.FileEditorInput;
16+
import org.eclipse.ui.plugin.AbstractUIPlugin;
17+
import org.osgi.framework.BundleContext;
18+
19+
/**
20+
*
21+
* @author Kenji Namba
22+
*/
23+
public class CodicPlugin extends AbstractUIPlugin {
24+
25+
/** The plug-in ID */
26+
public static final String PLUGIN_ID = "jp.codic.cep.core";
27+
28+
/** The shared instance */
29+
private static CodicPlugin plugin;
30+
31+
private static final String BUNDLE_NAME = CodicPlugin.class.getClass() + ".messages"; //$NON-NLS-1$
32+
33+
public static String ProjectPropertyPage_1;
34+
public static String ProjectPropertyPage_DESCRIPTION;
35+
public static String ProjectPropertyPage_API_KEY;
36+
public static String ProjectPropertyPage_PROJECT;
37+
public static String QuicklookDialog_SET_ACCESS_TOKEN;
38+
public static String QuicklookDialog_API_FAILED;
39+
public static String QuicklookDialog_1;
40+
41+
static {
42+
// initialize resource bundle
43+
NLS.initializeMessages(BUNDLE_NAME, CodicPlugin.class);
44+
}
45+
46+
/**
47+
* The constructor
48+
*/
49+
public CodicPlugin() {
50+
51+
}
52+
53+
@Override
54+
public void start(BundleContext context) throws Exception {
55+
super.start(context);
56+
plugin = this;
57+
}
58+
59+
@Override
60+
public void stop(BundleContext context) throws Exception {
61+
plugin = null;
62+
super.stop(context);
63+
}
64+
65+
/**
66+
* Returns the shared instance
67+
* @return the shared instance
68+
*/
69+
public static CodicPlugin getDefault() {
70+
return plugin;
71+
}
72+
73+
public static ImageDescriptor getImageDescriptor(String path) {
74+
return imageDescriptorFromPlugin(PLUGIN_ID, path);
75+
}
76+
77+
public IProject getActiveProject() {
78+
IEditorPart editorPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
79+
.getActivePage().getActiveEditor();
80+
if (editorPart != null) {
81+
IFileEditorInput input = (FileEditorInput) editorPart.getEditorInput();
82+
IFile file = input.getFile();
83+
return file.getProject();
84+
// activeProjectName = activeProject.getName();
85+
}
86+
return null;
87+
}
88+
89+
@Override
90+
protected void initializeImageRegistry(ImageRegistry reg) {
91+
reg.put("CodicPlugin.IMG_FONT", getImageDescriptor("/icons/font.gif"));
92+
}
93+
94+
/**
95+
* Activate view.
96+
*/
97+
public static void activateView(String id) {
98+
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
99+
IWorkbenchPage page = window.getActivePage();
100+
// TranslationView view = (TranslationView) page.findView(TranslationView.ID);
101+
try {
102+
page.showView(id);
103+
} catch (PartInitException e) {
104+
}
105+
106+
}
107+
108+
public static IEditorPart getActiveEditor(IWorkbenchWindow window) {
109+
return window.getActivePage().getActiveEditor();
110+
}
111+
112+
public static IProject getActiveEditorProject() {
113+
IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
114+
.getActiveEditor();
115+
IEditorInput input = editor.getEditorInput();
116+
if (!(input instanceof IFileEditorInput))
117+
return null;
118+
return ((IFileEditorInput) input).getFile().getProject();
119+
}
120+
121+
public static void log(String message) {
122+
System.out.println(message);
123+
}
124+
125+
public static String defaultString(String str) {
126+
return str == null ? "" : str;
127+
}
128+
129+
public static boolean isEmpty(String str) {
130+
return str == null || str.equals("");
131+
}
132+
}

0 commit comments

Comments
 (0)