Skip to content

Commit

Permalink
Merge pull request #1 from seasarorg/AddOutsideSqlLink
Browse files Browse the repository at this point in the history
Add OutsideSql link
  • Loading branch information
schatten4810 committed Feb 14, 2014
2 parents d606ba4 + b8afc9f commit e6e4b69
Show file tree
Hide file tree
Showing 60 changed files with 2,746 additions and 44 deletions.
17 changes: 17 additions & 0 deletions org.dbflute.emecha.feature/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.dbflute.emecha.feature</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.pde.FeatureBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.FeatureNature</nature>
</natures>
</projectDescription>
1 change: 1 addition & 0 deletions org.dbflute.emecha.feature/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bin.includes = feature.xml
35 changes: 35 additions & 0 deletions org.dbflute.emecha.feature/feature.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<feature
id="org.dbflute.emecha.feature"
label="DBFlute EMecha"
version="0.1.0">

<description url="http://dbflute.seasar.org/ja/manual/function/helper/emecha">
Eclipse Plugin for DBFlute
</description>

<copyright url="http://dbflute.seasar.org/ja/environment/license.html">
Copyright 2013 the Seasar Foundation and the Others.
</copyright>

<license url="http://dbflute.seasar.org/ja/environment/license.html">
Copyright 2013 the Seasar Foundation and the Others.
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
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.
</license>

<plugin
id="org.dbflute.emecha.synchronizer"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>

</feature>
12 changes: 12 additions & 0 deletions org.dbflute.emecha.synchronizer/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
<accessrules>
<accessrule kind="accessible" pattern="com/sun/net/httpserver/**"/>
</accessrules>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="src" path="src/main/resources"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
1 change: 1 addition & 0 deletions org.dbflute.emecha.synchronizer/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target
28 changes: 28 additions & 0 deletions org.dbflute.emecha.synchronizer/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.dbflute.emecha.synchronizer</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
291 changes: 291 additions & 0 deletions org.dbflute.emecha.synchronizer/.settings/org.eclipse.jdt.core.prefs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
eclipse.preferences.version=1
formatter_profile=_DBFlute
formatter_settings_version=12
org.eclipse.jdt.ui.javadoc=false
org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="getter \u30E1\u30BD\u30C3\u30C9\u306E\u30B3\u30E1\u30F3\u30C8" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="setter \u30E1\u30BD\u30C3\u30C9\u306E\u30B3\u30E1\u30F3\u30C8" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} \u30BB\u30C3\u30C8\u3059\u308B ${bare_field_name}\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="\u4F5C\u6210\u6E08\u307F\u30B3\u30F3\u30B9\u30C8\u30E9\u30AF\u30BF\u30FC\u306E\u30B3\u30E1\u30F3\u30C8" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * ${tags}\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="\u4F5C\u6210\u6E08\u307F\u306E Java \u30D5\u30A1\u30A4\u30EB\u306E\u30B3\u30E1\u30F3\u30C8" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*\n * Copyright ${year} the Seasar Foundation and the Others.\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http\://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n * either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="\u4F5C\u6210\u6E08\u307F\u306E\u578B\u306E\u30B3\u30E1\u30F3\u30C8" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * @author ${user}\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="\u30D5\u30A3\u30FC\u30EB\u30C9\u306E\u30B3\u30E1\u30F3\u30C8" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3057\u306A\u3044\u30E1\u30BD\u30C3\u30C9\u306E\u30B3\u30E1\u30F3\u30C8" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3059\u308B\u30E1\u30BD\u30C3\u30C9\u306E\u30B3\u30E1\u30F3\u30C8" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/**\n * {@inheritDoc}\n * ${see_to_overridden}\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="\u59D4\u8B72\u30E1\u30BD\u30C3\u30C9\u306E\u30B3\u30E1\u30F3\u30C8" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${tags}\n * ${see_to_target}\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="\u65B0\u898F\u4F5C\u6210\u30D5\u30A1\u30A4\u30EB" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="\u65B0\u898F\u30AF\u30E9\u30B9\u578B\u672C\u6587\u4E2D\u306E\u30B3\u30FC\u30C9" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="\u65B0\u898F\u30A4\u30F3\u30BF\u30FC\u30D5\u30A7\u30FC\u30B9\u578B\u672C\u6587\u4E2D\u306E\u30B3\u30FC\u30C9" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="\u65B0\u898F\u5217\u6319\u578B\u672C\u6587\u4E2D\u306E\u30B3\u30FC\u30C9" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="\u65B0\u898F\u6CE8\u91C8\u578B\u672C\u6587\u4E2D\u306E\u30B3\u30FC\u30C9" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="\u65B0\u898F catch \u30D6\u30ED\u30C3\u30AF\u4E2D\u306E\u30B3\u30FC\u30C9" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} \u81EA\u52D5\u751F\u6210\u3055\u308C\u305F catch \u30D6\u30ED\u30C3\u30AF\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="\u4F5C\u6210\u6E08\u307F\u30E1\u30BD\u30C3\u30C9\u30FB\u30B9\u30BF\u30D6\u4E2D\u306E\u30B3\u30FC\u30C9" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} \u81EA\u52D5\u751F\u6210\u3055\u308C\u305F\u30E1\u30BD\u30C3\u30C9\u30FB\u30B9\u30BF\u30D6\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="\u4F5C\u6210\u6E08\u307F\u30B3\u30F3\u30B9\u30C8\u30E9\u30AF\u30BF\u30FC\u30FB\u30B9\u30BF\u30D6\u4E2D\u306E\u30B3\u30FC\u30C9" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} \u81EA\u52D5\u751F\u6210\u3055\u308C\u305F\u30B3\u30F3\u30B9\u30C8\u30E9\u30AF\u30BF\u30FC\u30FB\u30B9\u30BF\u30D6</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="\u4F5C\u6210\u6E08\u307F getter \u4E2D\u306E\u30B3\u30FC\u30C9" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="\u4F5C\u6210\u6E08\u307F setter \u4E2D\u306E\u30B3\u30FC\u30C9" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
12 changes: 12 additions & 0 deletions org.dbflute.emecha.synchronizer/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: EMSynchronizer
Bundle-SymbolicName: org.dbflute.emecha.synchronizer;singleton:=true
Bundle-Version: 0.1.0
Bundle-Activator: org.dbflute.emecha.synchronizer.EMSynchronizer
Bundle-Vendor: Seasar DBFlute
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.core.resources
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
6 changes: 6 additions & 0 deletions org.dbflute.emecha.synchronizer/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source.. = src/main/java/,\
src/main/resources/
output.. = target/classes/
bin.includes = plugin.xml,\
META-INF/,\
.
26 changes: 26 additions & 0 deletions org.dbflute.emecha.synchronizer/plugin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.7"?>
<plugin>

<extension
point="org.eclipse.ui.preferencePages">
<page
name="EMSynchronizer"
class="org.dbflute.emecha.synchronizer.preferences.EMSynchronizerPreferencePage"
id="org.dbflute.emecha.synchronizer.preferences.EMSynchronizerPreferencePage">
</page>
</extension>
<extension
point="org.eclipse.core.runtime.preferences">
<initializer
class="org.dbflute.emecha.synchronizer.preferences.PreferenceInitializer">
</initializer>
</extension>
<extension
point="org.eclipse.ui.startup">
<startup
class="org.dbflute.emecha.synchronizer.EMSynchronizer">
</startup>
</extension>

</plugin>
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
* Copyright 2013 the Seasar Foundation and the Others.
*
* 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 org.dbflute.emecha.preferences;

import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;

/**
* EMecha prefarences pages grouping.
* @author schatten
*/
public class EMechaPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {

/**
*
*/
public EMechaPreferencePage() {
super("EMecha");
noDefaultAndApplyButton();
}

/**
* @param title
*/
public EMechaPreferencePage(String title) {
super(title);
noDefaultAndApplyButton();
}

/**
* {@inheritDoc}
* @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
*/
@Override
public void init(IWorkbench workbench) {
// nothing
}

/**
* {@inheritDoc}
* @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
*/
@Override
protected Control createContents(Composite parent) {
setTitle("This is blank page. Please select submenu.");
Composite composite = new Composite(parent, SWT.NONE);
return composite;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
/*
* Copyright 2013 the Seasar Foundation and the Others.
*
* 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 org.dbflute.emecha.synchronizer;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;

import org.dbflute.emecha.synchronizer.handler.RefreshHandler;
import org.dbflute.emecha.synchronizer.preferences.PreferenceConstants;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.IStartup;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;

import com.sun.net.httpserver.HttpServer;

/**
* The activator class controls the plug-in life cycle
*/
public class EMSynchronizer extends AbstractUIPlugin implements IStartup {

// The plug-in ID
public static final String PLUGIN_ID = "org.dbflute.emecha.synchronizer"; //$NON-NLS-1$

// The shared instance
private static EMSynchronizer plugin;

private HttpServer server;

private ExecutorService threadPool;

private int port;
/**
* The constructor
*/
public EMSynchronizer() {
}

/**
* {@inheritDoc}
* @see org.eclipse.ui.IStartup#earlyStartup()
*/
@Override
public void earlyStartup() {
// Startup plugin with Server
serverStart();
}

/*
* (non-Javadoc)
*
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
*/
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
}

/*
* (non-Javadoc)
*
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext context) throws Exception {
plugin = null;
serverStop();
super.stop(context);
}

public void serverStart() {
try {
plugin.port = plugin.getPreferenceStore().getInt(PreferenceConstants.P_LISTEN_PORT);
String hostname = "localhost";
HttpServer server = HttpServer.create(new InetSocketAddress(hostname, port), 0);
threadPool = Executors.newFixedThreadPool(1);
server.setExecutor(threadPool);
server.createContext("/", new RefreshHandler());
server.createContext("/refresh", new RefreshHandler());
server.start();
getLog().log(new Status(IStatus.INFO, PLUGIN_ID, "Synchronizer server is started at port"+ port +"."));
this.server = server;
} catch (IOException e) {
getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, "Synchronizer server is not started by error. (Port:" + port + ")", e));
server = null;
}
}

public void serverStop() throws InterruptedException {
if (server != null) {
server.stop(10);
}
if (threadPool != null && !threadPool.isShutdown()) {
threadPool.shutdownNow();
threadPool.awaitTermination(60, TimeUnit.SECONDS);
}
threadPool = null;
server = null;
}

public static void serverRestart() {
EMSynchronizer synchronizer = getDefault();
try {
synchronizer.serverStop();
synchronizer.serverStart();
} catch (InterruptedException e) {
synchronizer.getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, "Synchronizer server stop error.", e));
}
}

public static int getServerPort() {
return plugin.port;
}

/**
* Returns the shared instance
*
* @return the shared instance
*/
public static EMSynchronizer getDefault() {
return plugin;
}

/**
* Returns an image descriptor for the image file at the given plug-in relative path
*
* @param path the path
* @return the image descriptor
*/
public static ImageDescriptor getImageDescriptor(String path) {
return imageDescriptorFromPlugin(PLUGIN_ID, path);
}
}
Loading

0 comments on commit e6e4b69

Please sign in to comment.