У меня новая невозможная проблема, пока я разрабатываю плагин Eclipse. Я мог бы сделать это, но мой плагин должен изменить содержание TableView в меню «Нажмите». class = "Snippet-Code-Html Lang-Html PrettyPrint-Override">public void createPartControl( Composite parent )
{
CustomAction lCustomAction = new CustomAction( parent , 1 , this);
lCustomAction.setText("Load content with index 1");
lCustomAction.setImageDescriptor(Activator.getImageDescriptor("icons/sample.gif"));
getViewSite().getActionBars().getMenuManager().add(lCustomAction);
GridLayout layout = new GridLayout(2, false);
parent.setLayout(layout);
Thread t = new Thread( new RunSMV());
t.start();
}
public class CustomAction extends Action implements IWorkbenchAction
{
private Composite parent;
private int index;
SampleView sv;
public CustomAction(Composite parent, int index, SampleView sv)
{
setId(ID);
this.parent = parent;
this.index = index;
this.sv = sv;
}
public void run()
{
try
{
sv.createViewer(parent, index);
} catch (IOException | ParserConfigurationException | SAXException e) {
e.printStackTrace();
}
}
public void dispose() {}
}
public void createViewer(Composite parent, int index) throws IOException, ParserConfigurationException, SAXException
{
ArrayList listAll = RunNuSMV.RunNuSMV();
ArrayList list = listAll.get(index);
int numeroColonne = list.get(1).getN();
viewer = new TableViewer( parent , SWT.MULTI | SWT.H_SCROLL
| SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER);
createColumns( numeroColonne , parent , viewer);
final Table table = viewer.getTable();
table.setLinesVisible(true);
viewer.setContentProvider(new ArrayContentProvider());
TableColumn column[] = new TableColumn[numeroColonne];
for(int k=0;k < numeroColonne;k++ )
{
column[k] = new TableColumn(table, SWT.NONE);
}
CounterExample oldRow = list.get(0);
CounterExample row;
for (int i = 0; i < list.size(); i++)
{
row = list.get(i);
TableItem item1 = new TableItem(table, SWT.NONE);
item1.setText(row.getRow());
for(int j=0; j < numeroColonne;j++)
{
if(j != 0 && i >= 2 && row.getVar(j).equals(oldRow.getVar(j))==false )
{
Display disp = Display.getCurrent();
Color yellow = disp.getSystemColor(SWT.COLOR_YELLOW);
item1.setBackground( j , yellow );
}
}
oldRow = row;
}
for(int k=0;k
< /div>
< /div>
< /p>
Как вы можете себе представить, если я назову метод CreateView () в метод run () CustomAction, программа ничего не покажет. Событие.>
Подробнее здесь: https://stackoverflow.com/questions/340 ... views-menu