first commit

main
李建辉 1 month ago
commit c88f98fd3f

@ -0,0 +1,7 @@
<?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.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.connor.nhjs.screenshot</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>

@ -0,0 +1,7 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8

@ -0,0 +1,15 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Screenshot
Bundle-SymbolicName: com.connor.nhjs.screenshot;singleton:=true
Bundle-Version: 1.0.0
Bundle-Vendor: CONNOR
Require-Bundle: org.eclipse.ui,
com.teamcenter.rac.aifrcp;bundle-version="13000.1.0",
com.teamcenter.rac.common;bundle-version="13000.1.0",
com.teamcenter.rac.kernel;bundle-version="13000.1.0",
com.teamcenter.rac.tcapps;bundle-version="13000.1.0",
com.teamcenter.rac.util;bundle-version="13000.1.0"
Automatic-Module-Name: com.connor.nhjs.screenshot
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Export-Package: com.connor.nhjs.screenshot

1
bin/.gitignore vendored

@ -0,0 +1 @@
/com/

@ -0,0 +1,6 @@
source.. = src/
output.. = bin/
bin.includes = plugin.xml,\
META-INF/,\
.,\
icons/

Binary file not shown.

After

Width:  |  Height:  |  Size: 332 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 526 B

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="org.eclipse.ui.commands">
<command
name="内部截图"
id="com.connor.nhjs.screenshot.ScreenShotCommand">
</command>
<command
name="外部截图"
id="com.connor.nhjs.screenshot.ScreenShotCommand#true">
</command>
</extension>
<extension
point="org.eclipse.ui.handlers">
<handler
class="com.connor.nhjs.screenshot.ScreenShotHandler"
commandId="com.connor.nhjs.screenshot.ScreenShotCommand">
</handler>
<handler
class="com.connor.nhjs.screenshot.ScreenShotHandler"
commandId="com.connor.nhjs.screenshot.ScreenShotCommand#true">
</handler>
</extension>
<extension
point="org.eclipse.ui.menus">
<menuContribution
locationURI="menu:cn.net.connor.std.processedit.mainmenu?after=additions">
<menu id="com.connor.nhjs.screenshot" label="截图工具" mnemonic="M">
<command commandId="com.connor.nhjs.screenshot.ScreenShotCommand" id="com.connor.nhjs.screenshot.ScreenShotCommand" mnemonic="S"/>
<command commandId="com.connor.nhjs.screenshot.ScreenShotCommand#true" id="com.connor.nhjs.screenshot.ScreenShotCommand#true" mnemonic="S"/>
</menu>
</menuContribution>
</extension>
</plugin>

@ -0,0 +1,32 @@
package com.connor.nhjs.screenshot;
import com.teamcenter.rac.aif.AbstractAIFUIApplication;
import com.teamcenter.rac.aif.common.actions.AbstractAIFAction;
import com.teamcenter.rac.util.Instancer;
import com.teamcenter.rac.util.MessageBox;
public class ScreenShotAction extends AbstractAIFAction{
ScreenShotAction(AbstractAIFUIApplication app, String string) {
super(app,string);
}
@Override
public void run() {
// TODO Auto-generated method stub
try {
int ind = actionName.indexOf('#');
String action=actionName;
String actionData="";
if(ind>0) {
action=actionName.substring(0,ind);
actionData=actionName.substring(ind+1);
}
ScreenShotCommand command = (ScreenShotCommand) Instancer.newInstanceEx2(action, new Object[] { this.application, action, actionData });
command.executeModal();
} catch (Exception e) {
e.printStackTrace();
}
}
}

@ -0,0 +1,50 @@
package com.connor.nhjs.screenshot;
import org.eclipse.swt.widgets.Display;
import com.teamcenter.rac.aif.AIFDesktop;
import com.teamcenter.rac.aif.AbstractAIFApplication;
import com.teamcenter.rac.aif.AbstractAIFCommand;
import com.teamcenter.rac.aif.AbstractAIFUIApplication;
import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.util.MessageBox;
public class ScreenShotCommand extends AbstractAIFCommand{
private AbstractAIFUIApplication app;
private TCSession session;
protected String actionInfo;
private boolean hideTC;
private static final String PRE_SCREENSHOT = "Connor_ScreenShot_Command";
public ScreenShotCommand() {
super();
}
public ScreenShotCommand(AbstractAIFUIApplication app, String commandId, String actionInfo) {
this.app = app;
session = (TCSession)app.getSession();
this.actionInfo = actionInfo;
this.hideTC = "true".equals(actionInfo);
}
public void executeModal() throws Exception {
String cmd = session.getPreferenceService().getStringValue(PRE_SCREENSHOT);
if(cmd!=null&&cmd.length()>0) {
System.out.println("cmd======"+cmd);
if(hideTC) {
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
// System.out.println(AIFDesktop.getActiveDesktop().getShell());
AIFDesktop.getActiveDesktop().getShell().setMinimized(true);
}
});
Thread.sleep(600);
}
Runtime.getRuntime().exec(cmd);
}else {
MessageBox.post("ÇëÅäÖÃConnor_ScreenShot_CommandÊ×Ñ¡Ïî","",MessageBox.INFORMATION);
}
}
}

@ -0,0 +1,22 @@
package com.connor.nhjs.screenshot;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import com.teamcenter.rac.aif.AbstractAIFUIApplication;
import com.teamcenter.rac.aifrcp.AIFUtility;
public class ScreenShotHandler extends AbstractHandler{
private AbstractAIFUIApplication app;
@Override
public Object execute(ExecutionEvent arg0) throws ExecutionException {
// TODO Auto-generated method stub
app = AIFUtility.getCurrentApplication();
new Thread(new ScreenShotAction(app,arg0.getCommand().getId())).start();
return null;
}
}
Loading…
Cancel
Save