📄 modulelistsection.java
字号:
/*
* $Header: /home/cvs/WEBPUMP2.0/WebPumpIDE_Src/WebPumpIDE/src/com/webpump/ui/project/ModuleListSection.java,v 1.1.1.1 2004/07/01 09:07:51 wang_j Exp $
* $Revision: 1.1.1.1 $
* $Date: 2004/07/01 09:07:51 $
*
* ====================================================================
*
* The NanJing HopeRun(IT-FOREST) Software License, Version 2.0.0
*
* Copyright 2003-2004 by NanJing HopeRun(IT-FOREST) Information System Co., Ltd, CHINA and
* IT Forest Corporation
* All rights reserved.
*
* This software is the confidential and proprietary information of
* HopeRun(IT-FOREST) Information System Co., Ltd, CHINA and IT Forest Corporation.
* You shall not disclose such Confidential Information and shall use it only in
* accordance with the terms of the license agreement you entered into with
* HopeRun(IT-FOREST) Information System Co., Ltd, CHINA and IT Forest Corporation.
*/
package com.webpump.ui.project;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.pde.core.IModelChangedEvent;
import org.eclipse.pde.core.IModelChangedListener;
import org.eclipse.pde.internal.ui.editor.PDEFormSection;
import org.eclipse.pde.internal.ui.elements.DefaultTableProvider;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.Text;
import org.eclipse.update.ui.forms.internal.FormWidgetFactory;
import com.webpump.ui.base.data.BaseDataObject;
import com.webpump.ui.base.data.BaseModel;
import com.webpump.ui.base.gui.BasePage;
import com.webpump.ui.perspective.MacroResource;
import com.webpump.ui.perspective.WebpumpIDEPlugin;
import com.webpump.ui.wizard.ModuleDialog;
/**
* Project Info layout
*
* @author wang_j
* @version 2.0 2004-02-11
*/
public class ModuleListSection extends PDEFormSection
implements IModelChangedListener {
private FormWidgetFactory factory;
private TableViewer tableViewer;
private Text m_textConfig;
private boolean m_bListener = false;
/**
*柄择取值方式
*/
protected class TableLabelProvider extends LabelProvider implements ITableLabelProvider {
public Image getColumnImage(Object element, int columnIndex) {
return null;
}
public String getColumnText(Object element, int columnIndex) {
if (element instanceof ModuleInfo)
return ((ModuleInfo)element).getModelInfo()[columnIndex] ;
else
return null;
}
}
protected class TableContentProvider extends DefaultTableProvider {
public Object[] getElements(Object parent) {
if (parent instanceof BaseDataObject)
{
return ((BaseDataObject)parent).getChild();
}
return new Object[0];
}
}
/**
* the constructor
* @param page
*/
public ModuleListSection(BasePage page) {
super(page);
setHeaderText(WebpumpIDEPlugin.getResourceString(MacroResource.MODULELISTSECTION_HEADER_TEXT));
}
public Composite createClient(Composite parent, FormWidgetFactory factory) {
Composite container = factory.createComposite(parent);
final GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 3;
gridLayout.verticalSpacing = 9;
gridLayout.marginWidth = gridLayout.marginHeight = 2;
container.setLayout(gridLayout);
tableViewer = new TableViewer(container,SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
GridData GridData_1 = new GridData(GridData.FILL_VERTICAL);
tableViewer.getTable().setLayoutData(GridData_1);
//修改柄择取值方式
tableViewer.setContentProvider(new TableContentProvider());
tableViewer.setLabelProvider(new TableLabelProvider());
tableViewer.getTable().addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
IStructuredSelection selection = (IStructuredSelection)tableViewer.getSelection();
selectionChanged(selection);
}
});
tableViewer.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent e) {
handleDoubleClick((IStructuredSelection)e.getSelection());
}
});
Composite composite_1 = factory.createComposite(container);
GridLayout gridLayout_1 = new GridLayout();
composite_1.setLayout(gridLayout_1);
GridData_1 = new GridData(GridData.FILL_BOTH);
GridData_1.horizontalSpan = 2;
composite_1.setLayoutData(GridData_1);
factory.paintBordersFor(composite_1);
Label label = factory.createLabel(composite_1,WebpumpIDEPlugin.getResourceString(MacroResource.EXTENDSCONFIGSECTION_HEADER));
m_textConfig = factory.createText(composite_1,"",SWT.MULTI
| SWT.WRAP
| SWT.V_SCROLL
| FormWidgetFactory.BORDER_STYLE);
GridData_1 = new GridData(GridData.FILL_BOTH);
m_textConfig.setLayoutData(GridData_1);
m_textConfig.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
if (!m_bListener) return;
IStructuredSelection selection = (IStructuredSelection)tableViewer.getSelection();
if (selection!=null)
{
Object item = selection.getFirstElement();
if (item instanceof ModuleInfo)
{
ModuleInfo objModuleInfo = (ModuleInfo)item;
String[] strModuleInfo = objModuleInfo.getModelInfo();
strModuleInfo[3] = m_textConfig.getText();
objModuleInfo.setModelInfo(strModuleInfo);
}
}
}
});
factory.paintBordersFor(container);
return container;
}
/**
* 初始化柄择
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -