- 新增 CreateTempDrawingDialog 类用于创建临时图纸对话框 - 新增 CreateTempDrawingHandler 类用于处理创建临时图纸的命令 - 添加必要的资源文件和配置,如 .classpath、.project、build.properties 等 - 在 plugin.xml 中注册命令和菜单项mian
commit
f3403a4ab9
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry exported="true" kind="lib" path="lib/hutool-all-5.8.25.jar"/>
|
||||
<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,8 @@
|
||||
# 默认忽略的文件
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# 基于编辑器的 HTTP 客户端请求
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GitToolBoxBlameSettings">
|
||||
<option name="version" value="2" />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ASMSmaliIdeaPluginConfiguration">
|
||||
<asm skipDebug="true" skipFrames="true" skipCode="false" expandFrames="false" />
|
||||
<groovy codeStyle="LEGACY" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="JavaSE-1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/classes" />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>cn.net.connor.createTempDrawings</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,8 @@
|
||||
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.release=enabled
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
@ -0,0 +1,23 @@
|
||||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: CreateTempDrawings
|
||||
Bundle-SymbolicName: cn.net.connor.createTempDrawings;singleton:=true
|
||||
Bundle-Version: 1.0.0
|
||||
Automatic-Module-Name: cn.net.connor.createTempDrawings
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Require-Bundle: org.eclipse.ui;bundle-version="3.111.0",
|
||||
org.eclipse.core.runtime;bundle-version="3.15.100",
|
||||
com.teamcenter.rac.aifrcp;bundle-version="12000.3.0",
|
||||
com.teamcenter.rac.common;bundle-version="12000.3.0",
|
||||
com.teamcenter.rac.external;bundle-version="12000.3.0",
|
||||
com.teamcenter.rac.kernel;bundle-version="12000.3.0",
|
||||
com.teamcenter.rac.tcapps;bundle-version="12000.3.0",
|
||||
com.teamcenter.rac.ui;bundle-version="12000.3.0",
|
||||
com.teamcenter.rac.ui.commands;bundle-version="12000.3.0",
|
||||
com.teamcenter.rac.util;bundle-version="12000.3.0",
|
||||
k.util;bundle-version="1.0.0"
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Export-Package: cn.net.connor.createTempDrawings.dialogs,
|
||||
cn.net.connor.createTempDrawings.handlers
|
||||
Bundle-ClassPath: lib/hutool-all-5.8.25.jar,
|
||||
.
|
Binary file not shown.
Binary file not shown.
@ -0,0 +1,6 @@
|
||||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
plugin.xml,\
|
||||
lib/hutool-all-5.8.25.jar
|
Binary file not shown.
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?eclipse version="3.4"?>
|
||||
<plugin>
|
||||
<extension point="org.eclipse.ui.commands">
|
||||
<command name="创建临时图纸" id="CreateTempDrawing"/>
|
||||
</extension>
|
||||
<extension point="org.eclipse.ui.handlers">
|
||||
<handler commandId="CreateTempDrawing" class="cn.net.connor.createTempDrawings.handlers.CreateTempDrawingHandler"/>
|
||||
</extension>
|
||||
<extension point="org.eclipse.ui.menus">
|
||||
<menuContribution locationURI="menu:custWJ?after=projectCust">
|
||||
<command commandId="CreateTempDrawing" id="cn.net.connor.createTempDrawing.menu.createTempDrawing" mnemonic="S"/>
|
||||
</menuContribution>
|
||||
|
||||
<!--<menuContribution locationURI="menu:org.eclipse.ui.main.menu?after=additions">
|
||||
<menu label="测试" mnemonic="M" id="DesignToPartCommand">
|
||||
<command commandId="cn.net.connor.designtopart.commands.DesignToPartCommand" id="cn.net.connor.designtopart.menu.designtopart"/>
|
||||
</menu>
|
||||
</menuContribution>-->
|
||||
</extension>
|
||||
</plugin>
|
@ -0,0 +1,98 @@
|
||||
package cn.net.connor.createTempDrawings.dialogs;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.Label;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aif.AbstractAIFDialog;
|
||||
import com.teamcenter.rac.kernel.TCSession;
|
||||
import com.teamcenter.rac.util.PropertyLayout;
|
||||
import com.teamcenter.rac.util.UIUtilities;
|
||||
|
||||
public class CreateTempDrawingDialog extends AbstractAIFDialog implements ActionListener{
|
||||
private AbstractAIFApplication application;
|
||||
private TCSession tcSession ;
|
||||
private JLabel drawingObjTypeLabel;//图纸对象类型标签
|
||||
private JComboBox<String> drawingObjTypeComboBox;//图纸对象类型下拉输入框
|
||||
private JButton okButton;//确认按钮
|
||||
|
||||
public CreateTempDrawingDialog(AbstractAIFApplication application) {
|
||||
super(true);
|
||||
this.application = application;
|
||||
this.tcSession = (TCSession) this.application.getSession();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
System.out.println("开始加载创建临时图纸面板!");
|
||||
initUI();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建临时图纸对象-选择类型的看板
|
||||
*/
|
||||
private void initUI() throws Exception {
|
||||
this.setTitle("请选择图纸类型");
|
||||
this.setSize(800,600);
|
||||
this.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
|
||||
|
||||
JPanel centerPanel = new JPanel(new PropertyLayout());
|
||||
JPanel buttomPanel = new JPanel(new FlowLayout());
|
||||
|
||||
this.drawingObjTypeLabel = new JLabel("图纸对象类型 ");
|
||||
String[] drawingTypes = {"类型1", "类型2", "类型3"};
|
||||
JComboBox<String> drawingObjTypeComboBox = new JComboBox<String>(drawingTypes);
|
||||
|
||||
|
||||
|
||||
centerPanel.add("1.3.left.top",drawingObjTypeLabel);
|
||||
centerPanel.add("1.4.left.top",drawingObjTypeComboBox);
|
||||
|
||||
this.okButton = new JButton("确认");
|
||||
buttomPanel.add(okButton);
|
||||
|
||||
//按钮时间监听
|
||||
okButton.addActionListener(this);
|
||||
|
||||
//构造主面板
|
||||
this.setLayout(new BorderLayout());
|
||||
this.add(centerPanel, BorderLayout.CENTER);
|
||||
this.add(buttomPanel, BorderLayout.SOUTH);
|
||||
|
||||
//放到屏幕中央
|
||||
UIUtilities.centerToScreen(this);
|
||||
this.setVisible(true);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
// TODO 自动生成的方法存根
|
||||
Object s = e.getSource();
|
||||
try {
|
||||
if (e.equals(this.okButton)) {
|
||||
System.out.println("成功触发“确认”按钮!");
|
||||
|
||||
|
||||
}
|
||||
} catch (Exception e2) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
package cn.net.connor.createTempDrawings.handlers;
|
||||
|
||||
import org.eclipse.core.commands.AbstractHandler;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
|
||||
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||
import com.teamcenter.rac.kernel.TCComponentFolder;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||
import com.teamcenter.rac.util.MessageBox;
|
||||
|
||||
import cn.net.connor.createTempDrawings.dialogs.CreateTempDrawingDialog;
|
||||
|
||||
public class CreateTempDrawingHandler extends AbstractHandler {
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
System.out.println("创建临时图纸Handler···");
|
||||
int flag = 0;
|
||||
AbstractAIFApplication application = AIFUtility.getCurrentApplication();
|
||||
//1.判断选中对象是否符合要求
|
||||
InterfaceAIFComponent selectComponent = application.getTargetContext().getComponent();
|
||||
|
||||
System.out.println("当前选中对象类型为:"+selectComponent.getType());
|
||||
try {
|
||||
if (selectComponent instanceof TCComponentItemRevision) {
|
||||
TCComponentItemRevision itemRevision = (TCComponentItemRevision) selectComponent;
|
||||
String selectCompType = itemRevision.getStringProperty("object_type");
|
||||
if (selectCompType.equals("SB6_SZLXDRevision") || selectCompType.equals("SB6_LSWTCLTZDRevision")) {
|
||||
flag ++;
|
||||
}
|
||||
|
||||
}else if (selectComponent instanceof TCComponentFolder) {
|
||||
flag ++;
|
||||
}
|
||||
|
||||
if (flag != 0) {
|
||||
CreateTempDrawingDialog dialog = new CreateTempDrawingDialog(application);
|
||||
|
||||
new Thread(dialog).start();
|
||||
}else {
|
||||
MessageBox.post("请选择文件夹或试制联系单版本或临时问题处理通知单版本后执行创建临时图纸功能!" , "提示", MessageBox.INFORMATION);
|
||||
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
System.out.println("选中对象异常:");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in new issue