Skip to content

Commit

Permalink
Append Hyperlink key bindings. #2
Browse files Browse the repository at this point in the history
  • Loading branch information
schatten4810 committed Feb 20, 2014
1 parent af581a5 commit 9fd3b8e
Show file tree
Hide file tree
Showing 5 changed files with 139 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: DBFlute Assist Plugin
Bundle-SymbolicName: org.seasar.dbflute.emecha.eclipse.plugin.dfassist;singleton:=true
Bundle-Version: 0.0.3.0
Bundle-Version: 0.0.3.1
Bundle-Activator: org.seasar.dbflute.emecha.eclipse.plugin.dfassist.DfAssistPlugin
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
Expand Down
16 changes: 16 additions & 0 deletions org.seasar.dbflute.emecha.eclipse.plugin.dfassist/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,22 @@
name="OutsideSQL Link"
targetId="org.eclipse.jdt.ui.javaCode">
</hyperlinkDetector>
<hyperlinkDetector
activate="true"
class="org.seasar.dbflute.emecha.eclipse.plugin.dfassist.link.OutsideSqlFileHyperlinkDetector"
id="org.dbflute.emecha.assist.outsideSqlHyperlink_File"
name="OutsideSQL File Link"
modifierKeys="M3"
targetId="org.eclipse.jdt.ui.javaCode">
</hyperlinkDetector>
<hyperlinkDetector
activate="true"
class="org.seasar.dbflute.emecha.eclipse.plugin.dfassist.link.OutsideSqlEntityHyperlinkDetector"
id="org.dbflute.emecha.assist.outsideSqlHyperlink_Entity"
name="OutsideSQL Entity Link"
modifierKeys="M1+M3"
targetId="org.eclipse.jdt.ui.javaCode">
</hyperlinkDetector>
</extension>

<extension point="org.eclipse.ui.popupMenus">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* 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.seasar.dbflute.emecha.eclipse.plugin.dfassist.link;

import java.util.List;

import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor;
import org.eclipse.jdt.ui.actions.SelectionDispatchAction;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.hyperlink.IHyperlink;

import friend.org.eclipse.jdt.internal.ui.javaeditor.JavaElementHyperlinkDetector;

/**
*
* @author schatten
*/
@SuppressWarnings("restriction")
public class OutsideSqlEntityHyperlinkDetector extends JavaElementHyperlinkDetector {
/**
* @see org.eclipse.jdt.internal.ui.javaeditor.JavaElementHyperlinkDetector#addHyperlinks(org.eclipse.jface.text.IRegion, org.eclipse.jdt.ui.actions.SelectionDispatchAction, org.eclipse.jdt.core.IJavaElement, boolean, org.eclipse.ui.texteditor.ITextEditor)
*/
@Override
protected void addHyperlinks(List<IHyperlink> hyperlinksCollector, IRegion wordRegion,
SelectionDispatchAction openAction, IJavaElement element, boolean qualify, JavaEditor editor) {

if (element instanceof IType) {
String packageName = ((IType) element).getPackageFragment().getElementName();
if (packageName.endsWith(".exbhv.pmbean") || packageName.endsWith(".bsbhv.pmbean")) {
CustomizeEntityHyperlink entityLink = new CustomizeEntityHyperlink(wordRegion, openAction, (IType) element, qualify);
if (entityLink.existEntityType()) {
hyperlinksCollector.add(entityLink);
}
} else if (packageName.endsWith(".exentity.customize") || packageName.endsWith(".bsentity.customize")) {
ParameterBeanHyperlink pmbLink = new ParameterBeanHyperlink(wordRegion, openAction, (IType) element, qualify);
if (pmbLink.existPmbType()) {
hyperlinksCollector.add(pmbLink);
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* 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.seasar.dbflute.emecha.eclipse.plugin.dfassist.link;

import java.util.List;

import org.eclipse.jdt.core.IField;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor;
import org.eclipse.jdt.ui.actions.SelectionDispatchAction;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.hyperlink.IHyperlink;

import friend.org.eclipse.jdt.internal.ui.javaeditor.JavaElementHyperlinkDetector;

/**
*
* @author schatten
*/
@SuppressWarnings("restriction")
public class OutsideSqlFileHyperlinkDetector extends JavaElementHyperlinkDetector {
/**
* @see org.eclipse.jdt.internal.ui.javaeditor.JavaElementHyperlinkDetector#addHyperlinks(org.eclipse.jface.text.IRegion, org.eclipse.jdt.ui.actions.SelectionDispatchAction, org.eclipse.jdt.core.IJavaElement, boolean, org.eclipse.ui.texteditor.ITextEditor)
*/
@Override
protected void addHyperlinks(List<IHyperlink> hyperlinksCollector, IRegion wordRegion,
SelectionDispatchAction openAction, IJavaElement element, boolean qualify, JavaEditor editor) {

if (element instanceof IType) {
String packageName = ((IType) element).getPackageFragment().getElementName();
if (packageName.endsWith(".exbhv.pmbean") || packageName.endsWith(".bsbhv.pmbean")) {
SqlFileHyperlink sqlLink = new SqlFileHyperlink(wordRegion, openAction, (IType) element, qualify);
if (sqlLink.existSqlFile()) {
hyperlinksCollector.add(sqlLink);
}
} else if (packageName.endsWith(".exentity.customize") || packageName.endsWith(".bsentity.customize")) {
SqlFileHyperlink sqlLink = new SqlFileHyperlink(wordRegion, openAction, (IType) element, qualify);
if (sqlLink.existSqlFile()) {
hyperlinksCollector.add(sqlLink);
}
}
} else if (element instanceof IField) {
if (element.getElementName().startsWith("PATH_")) {
SqlFileHyperlink sqlLink = new SqlFileHyperlink(wordRegion, openAction, (IField) element, qualify);
if (sqlLink.existSqlFile()) {
hyperlinksCollector.add(sqlLink);
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ protected void addHyperlinks(List<IHyperlink> hyperlinksCollector, IRegion wordR
hyperlinksCollector.add(pmbLink);
}
}

} else if (element instanceof IField) {
if (element.getElementName().startsWith("PATH_")) {
SqlFileHyperlink sqlLink = new SqlFileHyperlink(wordRegion, openAction, (IField) element, qualify);
Expand Down

0 comments on commit 9fd3b8e

Please sign in to comment.