Java Code Examples for org.eclipse.jface.viewers.ISelectionChangedListener

The following are top voted examples for showing how to use org.eclipse.jface.viewers.ISelectionChangedListener. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: neoscada   File: SelectConnectionStorePage.java   View source code 7 votes vote down vote up
@Override
public void createControl ( final Composite parent )
{
    // stores must not be disposed!
    this.stores = Activator.getDefault ().getStoresSet ();

    this.tableViewer = new TableViewer ( parent );
    setControl ( this.tableViewer.getControl () );
    this.tableViewer.setContentProvider ( new ObservableSetContentProvider () );
    this.tableViewer.setLabelProvider ( new ConnectionLabelProvider () );
    this.tableViewer.setInput ( this.stores );

    this.tableViewer.addSelectionChangedListener ( new ISelectionChangedListener () {

        @Override
        public void selectionChanged ( final SelectionChangedEvent event )
        {
            update ();
        }
    } );

    update ();
}
 
Example 2
Project: Tarski   File: ContainerSelectionPage.java   View source code 6 votes vote down vote up
@Override
public void createControl(Composite parent) {
  Composite container = new Composite(parent, SWT.NONE);
  setControl(container);
  container.setLayout(new FillLayout(SWT.HORIZONTAL));

  treeViewer = new TreeViewer(container, SWT.BORDER);
  treeViewer.setUseHashlookup(true);
  treeViewer.setLabelProvider(new SigTypeLabelProvider());
  treeViewer.setContentProvider(new SigTypeContentProvider());
  treeViewer.setInput(ResourcesPlugin.getWorkspace().getRoot().getProjects());

  treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {

    @Override
    public void selectionChanged(SelectionChangedEvent event) {
      if (((TreeSelection) event.getSelection()).getFirstElement() instanceof IMarker) {
        selection = event.getSelection();
        ContainerSelectionPage.this.setPageComplete(true);
      } else {
        ContainerSelectionPage.this.setPageComplete(false);
      }
    }
  });
}
 
Example 3
Project: gw4e.project   File: ThreeStateComboChoice.java   View source code 6 votes vote down vote up
public ThreeStateComboChoice(Composite parent,ISelectionChangedListener listener) {
	super(parent, SWT.READ_ONLY);
	setContentProvider(ArrayContentProvider.getInstance());
	setLabelProvider(new LabelProvider() {
        @Override
        public String getText(Object element) {
            if (element instanceof ThreeStateChoice) {
            	ThreeStateChoice choice = (ThreeStateChoice) element;
            	return choice.getLabel();	                 
            }
            return "";
        }
    });
	addSelectionChangedListener(listener);
	
	setInput(choices);
}
 
Example 4
Project: scanning   File: ScanView.java   View source code 6 votes vote down vote up
protected void setPositionSelected(Composite position, List<Composite> positions, String propName, DelegatingSelectionProvider prov) {

		position.setFocus();
		seriesTable.deselectAll();
		for (Composite composite : positions) composite.setBackground(position.getDisplay().getSystemColor(SWT.COLOR_WHITE));
		position.setBackground(position.getDisplay().getSystemColor(SWT.COLOR_TITLE_BACKGROUND));

		seriesTable.addSelectionListener(new ISelectionChangedListener() {
			@Override
			public void selectionChanged(SelectionChangedEvent event) {
				position.setBackground(position.getDisplay().getSystemColor(SWT.COLOR_WHITE));
				seriesTable.removeSelectionListener(this);
			}
		});

		if (trees.containsKey(propName)) prov.fireSelection(new StructuredSelection(trees.get(propName)));
	}
 
Example 5
Project: n4js   File: TestResultsView.java   View source code 5 votes vote down vote up
private void hookSingleClickAction() {
	testTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
		@Override
		public void selectionChanged(SelectionChangedEvent event) {
			singleClickAction.run();
		}
	});
}
 
Example 6
Project: n4js   File: ChooseImplementationDialog.java   View source code 5 votes vote down vote up
@Override
protected Control createDialogArea(Composite container) {
	final Control control = super.createDialogArea(container);
	getTableViewer().addSelectionChangedListener(new ISelectionChangedListener() {
		@Override
		public void selectionChanged(SelectionChangedEvent event) {
			getOkButton().setEnabled(!getTableViewer().getSelection().isEmpty());
		}
	});
	return control;
}
 
Example 7
Project: avro-schema-editor   File: SchemaEditorContentPart.java   View source code 5 votes vote down vote up
private void init() {
	internalSelectionListener = new ISelectionChangedListener() {			
		@Override
		public void selectionChanged(SelectionChangedEvent event) {
			fireSelectionChangedEvent(getSelection(), SchemaEditorContentPart.this);
		}
	};
}
 
Example 8
Project: OCCI-Studio   File: MonitoringEditor.java   View source code 5 votes vote down vote up
/**
 * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to set this editor's overall selection.
 * Calling this result will notify the listeners.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setSelection(ISelection selection) {
	editorSelection = selection;

	for (ISelectionChangedListener listener : selectionChangedListeners) {
		listener.selectionChanged(new SelectionChangedEvent(this, selection));
	}
	setStatusLineManager(selection);
}
 
Example 9
Project: gw4e.project   File: GW4ELaunchConfigurationTab.java   View source code 5 votes vote down vote up
private void createTestContainerSelectionGroup (Composite parent) {
	Label fTestLabel = new Label(parent, SWT.NONE);
	GridData gd = new GridData( );
	gd.horizontalAlignment = SWT.RIGHT;
	gd.horizontalIndent = 25;
	gd.verticalAlignment=SWT.TOP;
	fTestLabel.setLayoutData(gd);
	fTestLabel.setText(MessageUtil.getString("mainTestExecutionContext"));
	 
	fMainTestExecutionComboViewer = new ComboViewer(parent,SWT.DROP_DOWN);
	Combo combo = fMainTestExecutionComboViewer.getCombo();
	combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	fMainTestExecutionComboViewer.setContentProvider(new   IStructuredContentProvider(){
		@Override
		public Object[] getElements(Object inputElement) {
			String projectName= (String) inputElement;
			loadMainExecutionContextTests(projectName);
			return mainExecutionContexts;
		}
	});
	ILabelProvider labelProvider = new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_QUALIFIED);
	fMainTestExecutionComboViewer.setLabelProvider(labelProvider);
	fMainTestExecutionComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
        @Override
        public void selectionChanged(SelectionChangedEvent event) {
        	 	fAdditionalTestViewer.setInput(null);
                IStructuredSelection selection = (IStructuredSelection) event.getSelection();
                if (selection.size() > 0){
                	  resetDoHint();
                      IType type =  (IType) selection.getFirstElement();
                      fAdditionalTestViewer.setInput(type);
                      validatePage();
                }
        }
	});
	combo.setData(GW4E_LAUNCH_CONFIGURATION_CONTROL_ID,GW4E_LAUNCH_TEST_CONFIGURATION_MAIN_TEST);
}
 
Example 10
Project: gw4e.project   File: TemplateComposite.java   View source code 5 votes vote down vote up
@Override
public void setSelection(ISelection selection) {
	this.selection = selection;
	for (ISelectionChangedListener iSelectionChangedListener : listeners) {
		iSelectionChangedListener.selectionChanged(new SelectionChangedEvent(this, selection));
	}
}
 
Example 11
Project: gw4e.project   File: GW4EEditor.java   View source code 5 votes vote down vote up
@Override
public void setSelection(ISelection selection) {
	currentEditorSelection = selection;
	for (ISelectionChangedListener listener : selectionChangedListeners) {
		listener.selectionChanged(new SelectionChangedEvent(this, selection));
	}
}
 
Example 12
Project: neoscada   File: AbstractSelectionProvider.java   View source code 5 votes vote down vote up
@Override
public void setSelection ( final ISelection selection )
{
    this.selection = selection;
    for ( final ISelectionChangedListener listener : this.listeners )
    {
        listener.selectionChanged ( new SelectionChangedEvent ( this, selection ) );
    }
}
 
Example 13
Project: scanning   File: ModelView.java   View source code 5 votes vote down vote up
@Override
public void createPartControl(Composite parent) {

	this.parent = parent;
	try {
		final Composite content = new Composite(parent, SWT.NONE);
		content.setLayout(new GridLayout(1, false));
		GridUtils.removeMargins(content);

		modelEditor = ServiceHolder.getInterfaceService().createModelViewer();
		modelEditor.setViewSite(getViewSite());
		modelEditor.createPartControl(content);
		GridUtils.setVisible(modelEditor.getControl(), true);

		final DelegatingSelectionProvider prov = new DelegatingSelectionProvider((ISelectionProvider)modelEditor);
		getSite().setSelectionProvider(prov);

		IScannableDeviceService cservice = ServiceHolder.getEventService().createRemoteService(new URI(CommandConstants.getScanningBrokerUri()), IScannableDeviceService.class);
		treeViewer = new ControlTreeViewer(cservice, ControlViewerMode.INDIRECT_NO_SET_VALUE);
		treeViewer.createPartControl(content, new ControlTree(), getViewSite().getActionBars().getMenuManager(), getViewSite().getActionBars().getToolBarManager());
		GridUtils.setVisible(treeViewer.getControl(), false);
		treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
			@Override
			public void selectionChanged(SelectionChangedEvent event) {
				prov.fireSelection(event.getSelection());
			}
		});

		setActionsVisible(false);

		PageUtil.getPage(getSite()).addSelectionListener(this);

	} catch (Exception ne) {
		logger.error("Unable to create model table!", ne);
	}

}
 
Example 14
Project: neoscada   File: ChartEditor.java   View source code 5 votes vote down vote up
/**
 * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to
 * set this editor's overall selection.
 * Calling this result will notify the listeners.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * 
 * @generated
 */
@Override
public void setSelection ( final ISelection selection )
{
    this.editorSelection = selection;

    for ( final ISelectionChangedListener listener : this.selectionChangedListeners )
    {
        listener.selectionChanged ( new SelectionChangedEvent ( this, selection ) );
    }
    setStatusLineManager ( selection );
}
 
Example 15
Project: time4sys   File: AnalysisEditor.java   View source code 5 votes vote down vote up
/**
 * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to set this editor's overall selection.
 * Calling this result will notify the listeners.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setSelection(ISelection selection) {
	editorSelection = selection;

	for (ISelectionChangedListener listener : selectionChangedListeners) {
		listener.selectionChanged(new SelectionChangedEvent(this, selection));
	}
	setStatusLineManager(selection);
}
 
Example 16
Project: gemoc-studio   File: GexpressionsEditor.java   View source code 5 votes vote down vote up
/**
 * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to set this editor's overall selection.
 * Calling this result will notify the listeners.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setSelection(ISelection selection) {
	editorSelection = selection;

	for (ISelectionChangedListener listener : selectionChangedListeners) {
		listener.selectionChanged(new SelectionChangedEvent(this, selection));
	}
	setStatusLineManager(selection);
}
 
Example 17
Project: Tarski   File: SelectionPage.java   View source code 5 votes vote down vote up
@Override
public void createControl(final Composite parent) {
  final Composite container = new Composite(parent, SWT.NONE);
  setControl(container);
  container.setLayout(new FillLayout(SWT.HORIZONTAL));

  treeViewer = new TreeViewer(container, SWT.BORDER);
  treeViewer.setUseHashlookup(true);
  treeViewer.setLabelProvider(new CreatingAtomWizardLabelProvider());
  treeViewer.setContentProvider(new CreatingAtomWizardContentProvider());
  treeViewer.setInput(ResourcesPlugin.getWorkspace().getRoot().getProjects());
  treeViewer.setFilters(new ViewerFilter[] {new CreatingAtomWizardFilter()});

  treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {

    @Override
    public void selectionChanged(final SelectionChangedEvent event) {
      if (((TreeSelection) event.getSelection()).getFirstElement() instanceof IMarker) {
        SelectionPage.this.setPageComplete(true);
      } else {
        SelectionPage.this.setPageComplete(false);
      }
    }
  });

  setPageComplete(false);
}
 
Example 18
Project: time4sys   File: MappingEditor.java   View source code 5 votes vote down vote up
/**
 * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to set this editor's overall selection.
 * Calling this result will notify the listeners.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setSelection(ISelection selection) {
	editorSelection = selection;

	for (ISelectionChangedListener listener : selectionChangedListeners) {
		listener.selectionChanged(new SelectionChangedEvent(this, selection));
	}
	setStatusLineManager(selection);
}
 
Example 19
Project: neoscada   File: SetupEditor.java   View source code 5 votes vote down vote up
/**
 * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to set this editor's overall selection.
 * Calling this result will notify the listeners.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setSelection ( ISelection selection )
{
    editorSelection = selection;

    for ( ISelectionChangedListener listener : selectionChangedListeners )
    {
        listener.selectionChanged ( new SelectionChangedEvent ( this, selection ) );
    }
    setStatusLineManager ( selection );
}
 
Example 20
Project: neoscada   File: OsgiEditor.java   View source code 5 votes vote down vote up
/**
 * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to set this editor's overall selection.
 * Calling this result will notify the listeners.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setSelection ( ISelection selection )
{
    editorSelection = selection;

    for ( ISelectionChangedListener listener : selectionChangedListeners )
    {
        listener.selectionChanged ( new SelectionChangedEvent ( this, selection ) );
    }
    setStatusLineManager ( selection );
}
 
Example 21
Project: gw4e.project   File: GW4ETemplatePage.java   View source code 5 votes vote down vote up
public GW4ETemplatePage(ISelectionChangedListener listener, List<TemplateProvider> templates,
		boolean displayProjects) {
	super("GraphWalker Template Page");
	this.setDescription("Create GraphWalker Graph");
	this.listener = listener;
	this.templates = templates;
	this.displayProjects = displayProjects;
}
 
Example 22
Project: neoscada   File: WorldEditor.java   View source code 5 votes vote down vote up
/**
 * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to set this editor's overall selection.
 * Calling this result will notify the listeners.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void setSelection ( ISelection selection )
{
    editorSelection = selection;

    for ( ISelectionChangedListener listener : selectionChangedListeners )
    {
        listener.selectionChanged ( new SelectionChangedEvent ( this, selection ) );
    }
    setStatusLineManager ( selection );
}
 
Example 23
Project: neoscada   File: MemoryEditor.java   View source code 5 votes vote down vote up
/**
 * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to set this editor's overall selection.
 * Calling this result will notify the listeners.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setSelection ( ISelection selection )
{
    editorSelection = selection;

    for ( ISelectionChangedListener listener : selectionChangedListeners )
    {
        listener.selectionChanged ( new SelectionChangedEvent ( this, selection ) );
    }
    setStatusLineManager ( selection );
}
 
Example 24
Project: time4sys   File: NfpEditor.java   View source code 5 votes vote down vote up
/**
 * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to set this editor's overall selection.
 * Calling this result will notify the listeners.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setSelection(ISelection selection) {
	editorSelection = selection;

	for (ISelectionChangedListener listener : selectionChangedListeners) {
		listener.selectionChanged(new SelectionChangedEvent(this, selection));
	}
	setStatusLineManager(selection);
}
 
Example 25
Project: neoscada   File: RecipeEditor.java   View source code 5 votes vote down vote up
/**
 * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to set this editor's overall selection.
 * Calling this result will notify the listeners.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setSelection ( ISelection selection )
{
    editorSelection = selection;

    for ( ISelectionChangedListener listener : selectionChangedListeners )
    {
        listener.selectionChanged ( new SelectionChangedEvent ( this, selection ) );
    }
    setStatusLineManager ( selection );
}
 
Example 26
Project: neoscada   File: InfrastructureEditor.java   View source code 5 votes vote down vote up
/**
 * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to set this editor's overall selection.
 * Calling this result will notify the listeners.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void setSelection ( ISelection selection )
{
    editorSelection = selection;

    for ( ISelectionChangedListener listener : selectionChangedListeners )
    {
        listener.selectionChanged ( new SelectionChangedEvent ( this, selection ) );
    }
    setStatusLineManager ( selection );
}
 
Example 27
Project: neoscada   File: SecurityEditor.java   View source code 5 votes vote down vote up
/**
 * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to set this editor's overall selection.
 * Calling this result will notify the listeners.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void setSelection ( ISelection selection )
{
    editorSelection = selection;

    for ( ISelectionChangedListener listener : selectionChangedListeners )
    {
        listener.selectionChanged ( new SelectionChangedEvent ( this, selection ) );
    }
    setStatusLineManager ( selection );
}
 
Example 28
Project: neoscada   File: GlobalizeEditor.java   View source code 5 votes vote down vote up
/**
 * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to set this editor's overall selection.
 * Calling this result will notify the listeners.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setSelection ( ISelection selection )
{
    editorSelection = selection;

    for ( ISelectionChangedListener listener : selectionChangedListeners )
    {
        listener.selectionChanged ( new SelectionChangedEvent ( this, selection ) );
    }
    setStatusLineManager ( selection );
}
 
Example 29
Project: neoscada   File: ComponentEditor.java   View source code 5 votes vote down vote up
/**
 * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to set this editor's overall selection.
 * Calling this result will notify the listeners.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void setSelection ( ISelection selection )
{
    editorSelection = selection;

    for ( ISelectionChangedListener listener : selectionChangedListeners )
    {
        listener.selectionChanged ( new SelectionChangedEvent ( this, selection ) );
    }
    setStatusLineManager ( selection );
}
 
Example 30
Project: gemoc-studio   File: FsmEditor.java   View source code 5 votes vote down vote up
/**
 * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to set this editor's overall selection.
 * Calling this result will notify the listeners.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setSelection(ISelection selection) {
	editorSelection = selection;

	for (ISelectionChangedListener listener : selectionChangedListeners) {
		listener.selectionChanged(new SelectionChangedEvent(this, selection));
	}
	setStatusLineManager(selection);
}
 
Example 31
Project: avro-schema-editor   File: SchemaRegistryView.java   View source code 5 votes vote down vote up
private void init() {
	internalSelectionListener = new ISelectionChangedListener() {			
		@Override
		public void selectionChanged(SelectionChangedEvent event) {
			if (editor != null) {
				updateToolbarOnSelectionChanged(event.getSelection());
				fireSelectionChangedEvent(event.getSelection(), SchemaRegistryView.this);
			}				
		}
	};
}
 
Example 32
Project: neoscada   File: ConfigurationEditor.java   View source code 5 votes vote down vote up
/**
 * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to set this editor's overall selection.
 * Calling this result will notify the listeners.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setSelection ( ISelection selection )
{
    editorSelection = selection;

    for ( ISelectionChangedListener listener : selectionChangedListeners )
    {
        listener.selectionChanged ( new SelectionChangedEvent ( this, selection ) );
    }
    setStatusLineManager ( selection );
}
 
Example 33
Project: gw4e.project   File: GeneratorChoiceComposite.java   View source code 5 votes vote down vote up
public void initialize(String widgetid, boolean active) {
	setEnabled(active);
	setContentProvider(new IStructuredContentProvider() {
		@Override
		public Object[] getElements(Object inputElement) {
			List<IFile> files = (List<IFile>) inputElement;
			Object[] ret = new Object[files.size()];
			int index = 0;
			for (IFile file : files) {
				ret[index++] = JavaCore.create(file);
			}
			return ret;
		}
	});
	setLabelProvider(new JavaElementLabelProvider(
			JavaElementLabelProvider.SHOW_QUALIFIED | JavaElementLabelProvider.SHOW_ROOT));
	addSelectionChangedListener(new ISelectionChangedListener() {
		@Override
		public void selectionChanged(SelectionChangedEvent event) {
			IStructuredSelection selection = (IStructuredSelection) event.getSelection();
			if (selection.size() > 0) {
				ICompilationUnit element = (ICompilationUnit) selection.getFirstElement();
				GeneratorChoiceComposite.this.pkgf = (IPackageFragment) element.getParent();
				listener.handleEvent(null);
			}
		}
	});
	setData(GW4E_CONVERSION_WIDGET_ID, widgetid);

	setInput(ancestors);
	if (active && hasItems()) {
		setSelection(new StructuredSelection(JavaCore.create(ancestors.get(0))));
	}
}
 
Example 34
Project: convertigo-eclipse   File: ProjectExplorerView.java   View source code 5 votes vote down vote up
public synchronized void clearSelectionChangedListeners() {
	Object[] listeners = selectionChangedListeners.getListeners();
	for (int i=0; i<listeners.length; i++) {
		removeSelectionChangedListener((ISelectionChangedListener)listeners[i]);
	}
	selectionChangedListeners.clear();
}
 
Example 35
Project: n4js   File: N4IDEXpectView.java   View source code 4 votes vote down vote up
/**
 * Adds selection listener and handler to the test tree view. On selection of broken test will display failure stack
 * trace in stack trace part of the view.
 */
private void createSelectionActions() {
	testTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
		@Override
		public void selectionChanged(SelectionChangedEvent event) {

			if (event.getSelection().isEmpty()) {
				stacktraceConsole.clear();
				stacktraceLabel.setText(NO_TRACE_MSG);
				stacktraceLabel.getParent().layout(true);
				return;
			}

			stacktraceConsole.clear();
			stacktraceLabel.setText(NO_TRACE_MSG);
			stacktraceLabel.getParent().layout(true);

			if (event.getSelection() instanceof IStructuredSelection) {
				IStructuredSelection selection = (IStructuredSelection) event.getSelection();

				Description desc = (Description) selection.getFirstElement();
				// handle failed test
				if (desc.isTest() && testsExecutionStatus.hasFailed(desc)) {
					Throwable failureException = testsExecutionStatus.getFailure(desc).getException();

					// print exception to trace window
					StringWriter stackTraceWriter = new StringWriter();
					failureException.printStackTrace(new PrintWriter(stackTraceWriter));
					String testName = N4IDEXpectFileNameUtil.getTestName(desc);

					// handle xpect run error
					if (testName.startsWith(N4IDEXpectFileNameUtil.TEST_FILE_INIT_ERROR_MSG)) {
						stacktraceLabel.setText("test initializaiton stack trace error");
						stacktraceLabel.getParent().layout(true);
						stacktraceConsole.write(stackTraceWriter.toString());
						return;
					}

					stacktraceLabel.setText("Stack trace of exception for "
							+ testName);
					stacktraceLabel.getParent().layout(true);
					stacktraceConsole.write(stackTraceWriter.toString());
				}
			}
		}
	});
}
 
Example 36
Project: smarthome-cep-demonstrator   File: SmarthomeEditor.java   View source code 4 votes vote down vote up
/**
 * This accesses a cached version of the content outliner.
 * <!-- begin-user-doc -->
    * <!-- end-user-doc -->
 * @generated
 */
   public IContentOutlinePage getContentOutlinePage() {
	if (contentOutlinePage == null) {
		// The content outline is just a tree.
		//
		class MyContentOutlinePage extends ContentOutlinePage {
			@Override
			public void createControl(Composite parent) {
				super.createControl(parent);
				contentOutlineViewer = getTreeViewer();
				contentOutlineViewer.addSelectionChangedListener(this);

				// Set up the tree viewer.
				//
				contentOutlineViewer.setUseHashlookup(true);
				contentOutlineViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
				contentOutlineViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
				contentOutlineViewer.setInput(editingDomain.getResourceSet());

				// Make sure our popups work.
				//
				createContextMenuFor(contentOutlineViewer);

				if (!editingDomain.getResourceSet().getResources().isEmpty()) {
				  // Select the root object in the view.
				  //
				  contentOutlineViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true);
				}
			}

			@Override
			public void makeContributions(IMenuManager menuManager, IToolBarManager toolBarManager, IStatusLineManager statusLineManager) {
				super.makeContributions(menuManager, toolBarManager, statusLineManager);
				contentOutlineStatusLineManager = statusLineManager;
			}

			@Override
			public void setActionBars(IActionBars actionBars) {
				super.setActionBars(actionBars);
				getActionBarContributor().shareGlobalActions(this, actionBars);
			}
		}

		contentOutlinePage = new MyContentOutlinePage();

		// Listen to selection so that we can handle it is a special way.
		//
		contentOutlinePage.addSelectionChangedListener
			(new ISelectionChangedListener() {
				 // This ensures that we handle selections correctly.
				 //
				 public void selectionChanged(SelectionChangedEvent event) {
					 handleContentOutlineSelection(event.getSelection());
				 }
			 });
	}

	return contentOutlinePage;
}
 
Example 37
Project: pgcodekeeper   File: ProjectEditorSelectionProvider.java   View source code 4 votes vote down vote up
@Override
public void addSelectionChangedListener(ISelectionChangedListener listener) {
    listeners.add(listener);
}
 
Example 38
Project: avro-schema-editor   File: SchemaViewer.java   View source code 4 votes vote down vote up
@Override
public void addSelectionChangedListener(ISelectionChangedListener listener) {
    selectionChangedListeners.add(listener);
}
 
Example 39
Project: OCCI-Studio   File: SlaEditor.java   View source code 4 votes vote down vote up
/**
 * This accesses a cached version of the content outliner.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public IContentOutlinePage getContentOutlinePage() {
	if (contentOutlinePage == null) {
		// The content outline is just a tree.
		//
		class MyContentOutlinePage extends ContentOutlinePage {
			@Override
			public void createControl(Composite parent) {
				super.createControl(parent);
				contentOutlineViewer = getTreeViewer();
				contentOutlineViewer.addSelectionChangedListener(this);

				// Set up the tree viewer.
				//
				contentOutlineViewer.setUseHashlookup(true);
				contentOutlineViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
				contentOutlineViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
				contentOutlineViewer.setInput(editingDomain.getResourceSet());

				// Make sure our popups work.
				//
				createContextMenuFor(contentOutlineViewer);

				if (!editingDomain.getResourceSet().getResources().isEmpty()) {
				  // Select the root object in the view.
				  //
				  contentOutlineViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true);
				}
			}

			@Override
			public void makeContributions(IMenuManager menuManager, IToolBarManager toolBarManager, IStatusLineManager statusLineManager) {
				super.makeContributions(menuManager, toolBarManager, statusLineManager);
				contentOutlineStatusLineManager = statusLineManager;
			}

			@Override
			public void setActionBars(IActionBars actionBars) {
				super.setActionBars(actionBars);
				getActionBarContributor().shareGlobalActions(this, actionBars);
			}
		}

		contentOutlinePage = new MyContentOutlinePage();

		// Listen to selection so that we can handle it is a special way.
		//
		contentOutlinePage.addSelectionChangedListener
			(new ISelectionChangedListener() {
				 // This ensures that we handle selections correctly.
				 //
				 public void selectionChanged(SelectionChangedEvent event) {
					 handleContentOutlineSelection(event.getSelection());
				 }
			 });
	}

	return contentOutlinePage;
}
 
Example 40
Project: OCCI-Studio   File: MonitoringEditor.java   View source code 4 votes vote down vote up
/**
 * This accesses a cached version of the content outliner.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public IContentOutlinePage getContentOutlinePage() {
	if (contentOutlinePage == null) {
		// The content outline is just a tree.
		//
		class MyContentOutlinePage extends ContentOutlinePage {
			@Override
			public void createControl(Composite parent) {
				super.createControl(parent);
				contentOutlineViewer = getTreeViewer();
				contentOutlineViewer.addSelectionChangedListener(this);

				// Set up the tree viewer.
				//
				contentOutlineViewer.setUseHashlookup(true);
				contentOutlineViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
				contentOutlineViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
				contentOutlineViewer.setInput(editingDomain.getResourceSet());

				// Make sure our popups work.
				//
				createContextMenuFor(contentOutlineViewer);

				if (!editingDomain.getResourceSet().getResources().isEmpty()) {
				  // Select the root object in the view.
				  //
				  contentOutlineViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true);
				}
			}

			@Override
			public void makeContributions(IMenuManager menuManager, IToolBarManager toolBarManager, IStatusLineManager statusLineManager) {
				super.makeContributions(menuManager, toolBarManager, statusLineManager);
				contentOutlineStatusLineManager = statusLineManager;
			}

			@Override
			public void setActionBars(IActionBars actionBars) {
				super.setActionBars(actionBars);
				getActionBarContributor().shareGlobalActions(this, actionBars);
			}
		}

		contentOutlinePage = new MyContentOutlinePage();

		// Listen to selection so that we can handle it is a special way.
		//
		contentOutlinePage.addSelectionChangedListener
			(new ISelectionChangedListener() {
				 // This ensures that we handle selections correctly.
				 //
				 public void selectionChanged(SelectionChangedEvent event) {
					 handleContentOutlineSelection(event.getSelection());
				 }
			 });
	}

	return contentOutlinePage;
}