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

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project acceleo-modules, under directory /psm-gen-scala/plugins/com.github.sbegaudeau.acceleo.modules.psm.gen.scala.editor/src-gen/com/github/sbegaudeau/acceleo/modules/psm/gen/scala/model/scala/presentation/.

Source file: ScalaActionBarContributor.java

  22 
vote

@Override public void run(){
  if (activeEditorPart instanceof IViewerProvider) {
    Viewer viewer=((IViewerProvider)activeEditorPart).getViewer();
    if (viewer != null) {
      viewer.refresh();
    }
  }
}
 

Example 2

From project acceleo-webapp-generator, under directory /plugins/org.eclipse.acceleo.tutorial.webapp.editor/src-gen/org/eclipse/acceleo/tutorial/webapp/presentation/.

Source file: WebappActionBarContributor.java

  22 
vote

@Override public void run(){
  if (activeEditorPart instanceof IViewerProvider) {
    Viewer viewer=((IViewerProvider)activeEditorPart).getViewer();
    if (viewer != null) {
      viewer.refresh();
    }
  }
}
 

Example 3

From project Database-Designer, under directory /plugins/org.obeonetwork.dsl.database.editor/src/org/obeonetwork/dsl/database/presentation/.

Source file: DatabaseActionBarContributor.java

  22 
vote

@Override public void run(){
  if (activeEditorPart instanceof IViewerProvider) {
    Viewer viewer=((IViewerProvider)activeEditorPart).getViewer();
    if (viewer != null) {
      viewer.refresh();
    }
  }
}
 

Example 4

From project EMF-IncQuery, under directory /tests/org.eclipse.viatra2.emf.incquery.snapshot.editor/src/org/eclipse/viatra2/emf/incquery/snapshot/EIQSnapshot/presentation/.

Source file: EIQSnapshotActionBarContributor.java

  22 
vote

@Override public void run(){
  if (activeEditorPart instanceof IViewerProvider) {
    Viewer viewer=((IViewerProvider)activeEditorPart).getViewer();
    if (viewer != null) {
      viewer.refresh();
    }
  }
}
 

Example 5

From project fr.obeo.performance, under directory /fr.obeo.performance.editor/src-gen/fr/obeo/performance/presentation/.

Source file: PerformanceActionBarContributor.java

  22 
vote

@Override public void run(){
  if (activeEditorPart instanceof IViewerProvider) {
    Viewer viewer=((IViewerProvider)activeEditorPart).getViewer();
    if (viewer != null) {
      viewer.refresh();
    }
  }
}
 

Example 6

From project mwe, under directory /plugins/org.eclipse.emf.mwe.ewm.editor/src/org/eclipse/emf/mwe/ewm/orchestration/presentation/.

Source file: OrchestrationActionBarContributor.java

  22 
vote

@Override public void run(){
  if (activeEditorPart instanceof IViewerProvider) {
    Viewer viewer=((IViewerProvider)activeEditorPart).getViewer();
    if (viewer != null) {
      viewer.refresh();
    }
  }
}
 

Example 7

From project Diver, under directory /ca.uvic.chisel.logging.eclipse/src/ca/uvic/chisel/logging/eclipse/internal/.

Source file: ViewerLogger.java

  21 
vote

protected void hookListeners(){
  IConfigurationElement configurationElement=getConfigurationElement();
  Viewer loggedViewer=getLoggedViewer();
  IPartLogger viewerLogger=getLogger();
  String addMethodName=configurationElement.getAttribute("addMethod");
  if (loggedViewer != null) {
    Method addMethod=findMethod(loggedViewer,addMethodName,viewerLogger.getClass());
    if (addMethod != null) {
      try {
        addMethod.invoke(loggedViewer,viewerLogger);
      }
 catch (      Exception e) {
        WorkbenchLoggingPlugin.getDefault().log(e);
        return;
      }
    }
  }
}
 

Example 8

From project eclipse.platform.runtime, under directory /bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/.

Source file: MetadataTreeContentProvider.java

  21 
vote

protected IStatus run(IProgressMonitor monitor){
  try {
    extractInfo(rootDir,rootNode,monitor);
    return Status.OK_STATUS;
  }
  finally {
    final Viewer tmpViewer=viewer;
    if (!tmpViewer.getControl().isDisposed())     tmpViewer.getControl().getDisplay().asyncExec(new Runnable(){
      public void run(){
        tmpViewer.refresh();
      }
    }
);
  }
}
 

Example 9

From project bndtools, under directory /bndtools.core/src/bndtools/editor/project/.

Source file: AvailableBundlesPart.java

  20 
vote

@Override public boolean select(Viewer viewer,Object parentElement,Object element){
  boolean select=false;
  if (element instanceof RepositoryBundle) {
    RepositoryBundle repoBundle=(RepositoryBundle)element;
    RepositoryPlugin repo=repoBundle.getRepo();
    if (includedRepos == null) {
      select=true;
    }
 else     if (repo instanceof WorkspaceRepository) {
      select=includedRepos.contains("Workspace");
    }
 else {
      select=includedRepos.contains(repoBundle.getRepo().getName());
    }
  }
 else {
    select=true;
  }
  return select;
}
 

Example 10

From project aws-toolkit-for-eclipse, under directory /com.amazonaws.eclipse.core/src/com/amazonaws/eclipse/explorer/.

Source file: AbstractContentProvider.java

  19 
vote

public void inputChanged(final Viewer viewer,final Object oldInput,final Object newInput){
  this.viewer=(TreeViewer)viewer;
  if (this.accountInfoChangeListener == null) {
    this.accountInfoChangeListener=new AccountInfoChangeListener(){
      @Override public void currentAccountChanged(){
        refresh();
      }
    }
;
    AwsToolkitCore.getDefault().addAccountInfoChangeListener(this.accountInfoChangeListener);
  }
  regionChangeRefreshListener=new DefaultRegionChangeRefreshListener(this);
}
 

Example 11

From project bel-editor, under directory /org.openbel.editor.ui/src/org/openbel/editor/ui/navigator/.

Source file: BELEditorContentProvider.java

  19 
vote

/** 
 * {@inheritDoc}
 */
@Override public void inputChanged(Viewer viewer,Object oldInput,Object newInput){
  if (this.viewer != null) {
    ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
  }
  this.viewer=(TreeViewer)viewer;
  if (this.viewer != null) {
    ResourcesPlugin.getWorkspace().addResourceChangeListener(this);
  }
  input=newInput;
}
 

Example 12

From project BHT-FPA, under directory /mailer-common/de.bht.fpa.mail.common/rcputils/de/ralfebert/rcputils/tables/sort/.

Source file: SortColumnComparator.java

  19 
vote

@SuppressWarnings({"unchecked","rawtypes"}) @Override public int compare(Viewer viewer,Object e1,Object e2){
  Table table=(Table)viewer.getControl();
  if (table.getSortDirection() == SWT.DOWN) {
    Object tmp=e1;
    e1=e2;
    e2=tmp;
  }
  TableColumn column=table.getSortColumn();
  if (column == null) {
    return super.compare(viewer,e1,e2);
  }
  IValue sortBy=(IValue)column.getData(SORT_BY);
  if (sortBy == null) {
    return super.compare(viewer,e1,e2);
  }
  Object v1=sortBy.getValue(e1);
  Object v2=sortBy.getValue(e2);
  if (v1 instanceof Comparable && v2 instanceof Comparable) {
    return ((Comparable)v1).compareTo(v2);
  }
  return super.compare(viewer,e1,e2);
}
 

Example 13

From project bioclipse.speclipse, under directory /plugins/net.bioclipse.spectrum/src/net/bioclipse/spectrum/editor/.

Source file: PeakSorter.java

  19 
vote

public int compare(Viewer viewer,Object obj1,Object obj2){
  int comp=0;
  CMLPeak p1=(CMLPeak)obj1;
  CMLPeak p2=(CMLPeak)obj2;
  int columnIndex=peakTableViewer.getColumnNames().indexOf(property);
switch (columnIndex) {
case 0:
    if (reverseSort) {
      comp=new Double(-(p1.getXValue())).compareTo(new Double(-(p2.getXValue())));
    }
 else {
      comp=new Double(p1.getXValue()).compareTo(new Double(p2.getXValue()));
    }
  break;
case 1:
if (reverseSort) {
  comp=new Double(-(p1.getYValue())).compareTo(new Double(-(p2.getYValue())));
}
 else {
  comp=new Double(p1.getYValue()).compareTo(new Double(p2.getYValue()));
}
break;
case 2:
comp=p1.getAttribute(peakTableViewer.getCmlPeakFields()[0]).getValue().compareTo(p2.getAttribute(peakTableViewer.getCmlPeakFields()[0]).getValue());
break;
case 3:
comp=p1.getAttribute(peakTableViewer.getCmlPeakFields()[1]).getValue().compareTo(p2.getAttribute(peakTableViewer.getCmlPeakFields()[1]).getValue());
break;
case 4:
comp=p1.getAttribute(peakTableViewer.getCmlPeakFields()[2]).getValue().compareTo(p2.getAttribute(peakTableViewer.getCmlPeakFields()[2]).getValue());
break;
case 5:
comp=p1.getAttribute(peakTableViewer.getCmlPeakFields()[3]).getValue().compareTo(p2.getAttribute(peakTableViewer.getCmlPeakFields()[3]).getValue());
break;
}
return comp;
}
 

Example 14

From project bpelunit, under directory /tycho/net.bpelunit.framework.client.eclipse/src/net/bpelunit/framework/client/eclipse/launch/.

Source file: BPELLaunchMainTab.java

  19 
vote

/** 
 * Show a dialog that lists all main types
 */
protected void handleSearchButtonSelected(){
  ElementTreeSelectionDialog dialog=new ElementTreeSelectionDialog(getShell(),new WorkbenchLabelProvider(),new WorkbenchContentProvider());
  dialog.setTitle("Select a .bpts file:");
  dialog.setMessage("Select the .bpts file to run:");
  dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
  dialog.setSorter(new ResourceSorter(ResourceSorter.NAME));
  dialog.addFilter(new ViewerFilter(){
    @Override public boolean select(    Viewer viewer,    Object parentElement,    Object element){
      if (element instanceof IFile) {
        IFile file=(IFile)element;
        if (!file.getFileExtension().equals("bpts"))         return false;
      }
      return true;
    }
  }
);
  dialog.setAllowMultiple(false);
  dialog.setValidator(new ISelectionStatusValidator(){
    public IStatus validate(    Object[] selection){
      if ((selection != null) && (selection.length > 0)) {
        Object first=selection[0];
        if (first instanceof IFile) {
          IFile file=(IFile)first;
          if (file.getFileExtension().equals("bpts"))           return Status.OK_STATUS;
        }
      }
      return new Status(IStatus.ERROR,BPELUnitActivator.getUniqueIdentifier(),-1,"Select a .bpts file.",null);
    }
  }
);
  if (dialog.open() == IDialogConstants.OK_ID) {
    IResource resource=(IResource)dialog.getFirstResult();
    if (!(resource instanceof IFile) || !resource.getFileExtension().equals("bpts")) {
      MessageDialog.openError(this.getShell(),"BPELUnit Test Suite","Must select a file with a .bpts ending");
    }
 else {
      fSuiteText.setText(resource.getProjectRelativePath().toString());
    }
  }
}
 

Example 15

From project bundlemaker, under directory /main/org.bundlemaker.core.ui/src/org/bundlemaker/core/ui/handler/.

Source file: RunTransformationScriptHandler.java

  19 
vote

public boolean select(Viewer viewer,Object parent,Object element){
  System.out.println("element: " + element);
  if (element instanceof IProject) {
    IProject project=(IProject)element;
    if (!project.isOpen()) {
      return false;
    }
    try {
      if (project.hasNature(BundleMakerCore.NATURE_ID)) {
        IBundleMakerProject bundleMakerProject=BundleMakerCore.getBundleMakerProject(project,null);
        return (bundleMakerProject.getState() == BundleMakerProjectState.READY);
      }
    }
 catch (    CoreException e) {
      reportError(Activator.PLUGIN_ID,e.toString(),e);
    }
  }
  return false;
}
 

Example 16

From project ccw, under directory /ccw.core/src/java/ccw/editors/outline/.

Source file: ClojureOutlinePage.java

  19 
vote

@Override public void createControl(Composite parent){
  super.createControl(parent);
  treeViewer=getTreeViewer();
  treeViewer.setContentProvider(new ITreeContentProvider(){
    public void inputChanged(    Viewer viewer,    Object oldInput,    Object newInput){
    }
    public void dispose(){
    }
    public Object[] getElements(    Object input){
      return ((List<?>)input).toArray();
    }
    public boolean hasChildren(    Object arg0){
      return false;
    }
    public Object getParent(    Object arg0){
      return null;
    }
    public Object[] getChildren(    Object arg0){
      return null;
    }
  }
);
  treeViewer.setLabelProvider(new DelegatingStyledCellLabelProvider(new OutlineLabelProvider()));
  treeViewer.addSelectionChangedListener(this);
  treeViewer.setInput(forms);
  treeSelectionChangedListener=new TreeSelectionChangedListener();
  treeViewer.addSelectionChangedListener(treeSelectionChangedListener);
  IPostSelectionProvider selectionProvider=(IPostSelectionProvider)editor.getSelectionProvider();
  editorSelectionChangedListener=new EditorSelectionChangedListener(treeViewer);
  selectionProvider.addPostSelectionChangedListener(editorSelectionChangedListener);
  ISelection selection=selectionProvider.getSelection();
  selectInOutline(selection);
  registerToolbarActions();
}
 

Example 17

From project ceylon-ide-eclipse, under directory /plugins/com.redhat.ceylon.eclipse.ui/src/com/redhat/ceylon/eclipse/code/explorer/.

Source file: PackageExplorerContentProvider.java

  19 
vote

@Override public void inputChanged(Viewer viewer,Object oldInput,Object newInput){
  super.inputChanged(viewer,oldInput,newInput);
  fViewer=(TreeViewer)viewer;
  if (oldInput == null && newInput != null) {
    JavaCore.addElementChangedListener(this);
  }
 else   if (oldInput != null && newInput == null) {
    JavaCore.removeElementChangedListener(this);
  }
  fInput=newInput;
}
 

Example 18

From project cilia-workbench, under directory /cilia-workbench-common/src/fr/liglab/adele/cilia/workbench/common/ui/editors/.

Source file: KeyValueEditor.java

  19 
vote

@Override protected ViewerComparator getDefaultComparator(){
  return new ViewerComparator(){
    @Override public int compare(    Viewer viewer,    Object e1,    Object e2){
      String str1=((String[])e1)[0];
      String str2=((String[])e2)[0];
      return (str1.toUpperCase()).compareTo(str2.toUpperCase());
    }
  }
;
}
 

Example 19

From project dawn-common, under directory /org.dawb.common.ui/src/org/dawb/common/ui/plot/function/.

Source file: FunctionEditTable.java

  19 
vote

/** 
 * Can be called also to change to editing a different function.
 * @param function
 * @param functionType - may be null
 */
public void setFunction(final AFunction function,final FunctionType functionType){
  this.setFunctionType(functionType);
  this.originalFunction=function != null ? function : null;
  this.function=function != null ? function : null;
  this.rows=createFunctionRows(function);
  functionTable.setContentProvider(new IStructuredContentProvider(){
    @Override public void inputChanged(    Viewer viewer,    Object oldInput,    Object newInput){
    }
    @Override public void dispose(){
    }
    @Override public Object[] getElements(    Object inputElement){
      return rows.toArray(new FunctionRow[rows.size()]);
    }
  }
);
  functionTable.setInput(rows.get(0));
}
 

Example 20

From project dawn-isenciaui, under directory /com.isencia.passerelle.workbench.model.editor.ui/src/main/java/com/isencia/passerelle/workbench/model/editor/ui/views/.

Source file: ActorAttributesView.java

  19 
vote

private void createTableModel(final List<Attribute> parameterList){
  if (parameterList != null)   Collections.sort(parameterList,new NamedObjComparator());
  try {
    viewer.setContentProvider(new IStructuredContentProvider(){
      @Override public void dispose(){
      }
      @Override public void inputChanged(      Viewer viewer,      Object oldInput,      Object newInput){
      }
      @Override public Object[] getElements(      Object inputElement){
        if (parameterList == null)         return new Parameter[]{};
        final List<Object> ret=new ArrayList<Object>(parameterList.size() + 1);
        final Director director=actor instanceof Actor ? (Director)((Actor)actor).getDirector() : null;
        if (actor instanceof Actor)         ret.add(new GeneralAttribute(GeneralAttribute.ATTRIBUTE_TYPE.TYPE,PaletteItemFactory.getInstance().getType(actor.getClass())));
        if (actor instanceof Actor && director != null && director.isExpertMode())         ret.add(new GeneralAttribute(GeneralAttribute.ATTRIBUTE_TYPE.CLASS,actor.getClass().getName()));
        ret.add(new GeneralAttribute(GeneralAttribute.ATTRIBUTE_TYPE.NAME,PaletteItemFactory.getInstance().getType(actor.getName())));
        ret.addAll(parameterList);
        return ret.toArray(new Object[ret.size()]);
      }
    }
);
    viewer.setInput(new Object());
    viewer.refresh();
  }
 catch (  Exception e) {
    logger.error("Cannot set input",e);
  }
}
 

Example 21

From project dawn-ui, under directory /org.dawb.workbench.plotting/src/org/dawb/workbench/plotting/tools/.

Source file: EllipseFittingTool.java

  19 
vote

@Override public void createControl(Composite parent){
  composite=new Composite(parent,SWT.NONE);
  composite.setLayout(new FillLayout());
  viewer=new TableViewer(composite,SWT.FULL_SELECTION | SWT.SINGLE | SWT.H_SCROLL| SWT.V_SCROLL| SWT.BORDER);
  createColumns(viewer);
  Table t=viewer.getTable();
  t.setLinesVisible(true);
  t.setHeaderVisible(true);
  createActions();
  getSite().setSelectionProvider(viewer);
  viewer.setContentProvider(new IStructuredContentProvider(){
    @Override public void inputChanged(    Viewer viewer,    Object oldInput,    Object newInput){
    }
    @Override public void dispose(){
    }
    @Override public Object[] getElements(    Object inputElement){
      return ellipses.toArray();
    }
  }
);
  viewer.setInput(ellipses);
  parent.layout();
}
 

Example 22

From project dawn-workflow, under directory /org.dawb.passerelle.actors/src/org/dawb/passerelle/editors/.

Source file: SubstitutionEditor.java

  19 
vote

private IContentProvider createActorContentProvider(){
  return new IStructuredContentProvider(){
    @Override public void dispose(){
    }
    @Override public void inputChanged(    Viewer viewer,    Object oldInput,    Object newInput){
    }
    @Override public Object[] getElements(    Object inputElement){
      if (actor == null)       return new Object[]{"-"};
      final List<IVariable> vars=actor.getInputVariables();
      if (vars != null && !vars.isEmpty())       return vars.toArray();
      return new Object[]{"-"};
    }
  }
;
}
 

Example 23

From project droolsjbpm-tools, under directory /drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/core/ui/.

Source file: DroolsFilter.java

  19 
vote

public boolean select(Viewer viewer,Object parentElement,Object element){
  if (element instanceof DroolsElement) {
    DroolsElement droolsElement=(DroolsElement)element;
    int type=droolsElement.getType();
    if (hasFilter(FILTER_RULES) && type == DroolsElement.RULE) {
      return false;
    }
    if (hasFilter(FILTER_QUERIES) && type == DroolsElement.QUERY) {
      return false;
    }
    if (hasFilter(FILTER_FUNCTIONS) && type == DroolsElement.FUNCTION) {
      return false;
    }
    if (hasFilter(FILTER_TEMPLATES) && type == DroolsElement.TEMPLATE) {
      return false;
    }
    if (hasFilter(FILTER_GLOBALS) && type == DroolsElement.GLOBAL) {
      return false;
    }
    if (hasFilter(FILTER_GROUPS) && ((type == DroolsElement.AGENDA_GROUP) || (type == DroolsElement.RULEFLOW_GROUP) || (type == DroolsElement.ACTIVATION_GROUP)|| (type == DroolsElement.DEFAULT_RULE_GROUP))) {
      return false;
    }
  }
  return true;
}
 

Example 24

From project e4-rendering, under directory /com.toedter.e4.demo.contacts.swt/src/com/toedter/e4/demo/contacts/swt/views/.

Source file: ContactViewerComparator.java

  19 
vote

@Override public int compare(final Viewer viewer,final Object obj1,final Object obj2){
  if (obj1 instanceof Contact && obj2 instanceof Contact) {
    String lastName1=((Contact)obj1).getLastName();
    String lastName2=((Contact)obj2).getLastName();
    if (lastName1 == null) {
      lastName1="";
    }
    if (lastName2 == null) {
      lastName2="";
    }
    return lastName1.compareTo(lastName2);
  }
 else {
    throw new IllegalArgumentException("Can only compare two Contacts.");
  }
}
 

Example 25

From project Eclipse, under directory /com.mobilesorcery.sdk.profiling.ui/src/com/mobilesorcery/sdk/profiling/ui/views/.

Source file: InvocationViewerFilter.java

  19 
vote

public boolean select(Viewer viewer,Object parentElement,Object element){
  if (element instanceof IInvocation) {
    IInvocation invocation=(IInvocation)element;
    boolean result=element != null && (filter == null || filter.accept(invocation));
    if (recursive && !result) {
      for (      IInvocation child : invocation.getInvocations()) {
        if (select(viewer,element,child)) {
          return true;
        }
      }
    }
 else {
      return result;
    }
  }
  return false;
}
 

Example 26

From project eclipse-instasearch, under directory /instasearch/src/it/unibz/instasearch/ui/.

Source file: ResultContentProvider.java

  19 
vote

public void inputChanged(Viewer v,Object oldInput,Object newSearch){
  if (newSearch == null || !(newSearch instanceof SearchQuery)) {
    currentSearchQuery=null;
    cachedResults=null;
  }
}
 

Example 27

From project eclipse-integration-cloudfoundry, under directory /org.cloudfoundry.ide.eclipse.server.ui/src/org/cloudfoundry/ide/eclipse/internal/server/ui/.

Source file: CloudSpacesSelectionPart.java

  19 
vote

public int compare(Viewer viewer,Object e1,Object e2){
  if (e1 instanceof CloudEntity && e1 instanceof CloudEntity) {
    String name1=((CloudEntity)e1).getName();
    String name2=((CloudEntity)e2).getName();
    return name1.compareTo(name2);
  }
  return super.compare(viewer,e1,e2);
}
 

Example 28

From project eclipse-integration-commons, under directory /org.springsource.ide.eclipse.commons.frameworks.ui/src/org/springsource/ide/eclipse/commons/frameworks/ui/internal/plugins/.

Source file: PluginManagerDialog.java

  19 
vote

public boolean select(Viewer viewer,Object parentElement,Object element){
  if (element instanceof RootTreeElement) {
    RootTreeElement treeElement=(RootTreeElement)element;
    PluginState state=treeElement.getPluginState();
    if (option != null) {
switch (option) {
case SHOW_AVAILABLE_UPDATES_ONLY:
        if (state != PluginState.UPDATE_AVAILABLE) {
          return hasUpdate(treeElement.getVersionModel());
        }
      break;
case SHOW_CHANGES_ONLY:
    if (state != PluginState.SELECT_INSTALL && state != PluginState.SELECT_UNINSTALL) {
      return false;
    }
  break;
case SHOW_INSTALLED_ONLY:
if (state == null) {
  return false;
}
 else {
  return treeElement.getVersionModel().getParent().isInstalled();
}
}
}
}
return true;
}
 

Example 29

From project eclipse-integration-gradle, under directory /org.springsource.ide.eclipse.gradle.ui/src/org/springsource/ide/eclipse/gradle/ui/launch/.

Source file: GradleTaskTreeContentProvider.java

  19 
vote

public void inputChanged(Viewer viewer,Object oldInput,Object newInput){
  Assert.isTrue(this.viewer == viewer);
  Assert.isTrue(newInput == null || newInput instanceof GradleProject);
  setProject((GradleProject)newInput);
  if (projectProv != null) {
    projectProv.inputChanged(viewer,oldInput,newInput);
  }
}
 

Example 30

From project eclipse-task-editor, under directory /plugins/de.sebastianbenz.task.ui/src/de/sebastianbenz/task/ui/views/.

Source file: QueryBasedFilter.java

  19 
vote

@Override public boolean select(Viewer viewer,Object parentElement,Object element){
  this.viewer=viewer;
  if (!(element instanceof EObject)) {
    return true;
  }
  return queryInterpreter.select(query,(EObject)element);
}
 

Example 31

From project eclipsefp, under directory /net.sf.eclipsefp.haskell.ui/src/net/sf/eclipsefp/common/ui/dialog/.

Source file: WSFileDialogField.java

  19 
vote

private void addFilter(final ElementTreeSelectionDialog dialog){
  if (extension != null) {
    dialog.addFilter(new ViewerFilter(){
      @Override public boolean select(      final Viewer viewer,      final Object parentElement,      final Object element){
        boolean result=true;
        IResource res=(IResource)element;
        if (res instanceof IFile) {
          result=res.getFileExtension().equals(extension);
        }
        return result;
      }
    }
);
  }
}
 

Example 32

From project edna-rcp, under directory /org.edna.plugingenerator/src/org/edna/plugingenerator/generator/.

Source file: WizardHelpers.java

  19 
vote

static public IFile getFilename(Shell parent,String title,String messgage,final String extention){
  ElementTreeSelectionDialog dialog=new ElementTreeSelectionDialog(parent,new WorkbenchLabelProvider(),new BaseWorkbenchContentProvider());
  dialog.setTitle(title);
  dialog.setMessage(messgage);
  dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
  dialog.addFilter(new ViewerFilter(){
    @Override public boolean select(    Viewer viewer,    Object parentElement,    Object element){
      try {
        IFile file=(IFile)element;
        if (file.getFileExtension().equals(extention)) {
          return true;
        }
 else {
          return false;
        }
      }
 catch (      Exception e) {
        return true;
      }
    }
  }
);
  dialog.setValidator(new ISelectionStatusValidator(){
    @Override public IStatus validate(    Object[] selection){
      if (selection.length == 1 && selection[0] instanceof IFile) {
        return new Status(IStatus.OK,Activator.PLUGIN_ID,0,"",null);
      }
      return new Status(IStatus.ERROR,Activator.PLUGIN_ID,0,"Please select an " + extention + " file!",null);
    }
  }
);
  dialog.open();
  return (IFile)dialog.getResult()[0];
}
 

Example 33

From project eik, under directory /plugins/info.evanchik.eclipse.karaf.ui/src/main/java/info/evanchik/eclipse/karaf/ui/features/.

Source file: FeaturesContentProvider.java

  19 
vote

@Override @SuppressWarnings("unchecked") public void inputChanged(final Viewer viewer,final Object oldInput,final Object newInput){
  if (newInput != null) {
    if (newInput instanceof List) {
      featuresRepositories=(List<FeaturesRepository>)newInput;
    }
  }
}
 

Example 34

From project Foglyn, under directory /com.foglyn.ui/src/com/foglyn/helpers/.

Source file: AreaFilter.java

  19 
vote

@Override protected boolean selectElement(Viewer viewer,Object parentElement,FogBugzArea area){
  if (projectID == null) {
    return false;
  }
  return projectID.equals(area.getProject());
}
 

Example 35

From project gda-common-rcp, under directory /uk.ac.gda.common.rcp/src/uk/ac/gda/richbeans/components/selector/.

Source file: GridListEditor.java

  19 
vote

private void createContentProvider(){
  if (gridTable == null)   return;
  final Integer[] vals=new Integer[rows];
  for (int i=0; i < vals.length; i++)   vals[i]=i;
  gridTable.setContentProvider(new IStructuredContentProvider(){
    @Override public void dispose(){
    }
    @Override public void inputChanged(    Viewer viewer,    Object oldInput,    Object newInput){
    }
    @Override public Object[] getElements(    Object inputElement){
      return vals;
    }
  }
);
}
 

Example 36

From project gmc, under directory /src/org.gluster.storage.management.console/src/org/gluster/storage/management/console/utils/.

Source file: EntityViewerFilter.java

  19 
vote

@SuppressWarnings("unchecked") @Override public boolean select(Viewer viewer,Object parentElement,Object element){
  if (filterString == null || filterString.isEmpty()) {
    return true;
  }
  if (element instanceof Filterable) {
    return ((Filterable)element).filter(filterString,caseSensitive);
  }
  if (element instanceof Entry) {
    Entry<String,String> entry=(Entry<String,String>)element;
    return StringUtil.filterString(entry.getKey() + entry.getValue(),filterString,caseSensitive);
  }
  if (element instanceof String) {
    return StringUtil.filterString((String)element,filterString,caseSensitive);
  }
  return false;
}
 

Example 37

From project grails-ide, under directory /org.grails.ide.eclipse.explorer/src/org/grails/ide/eclipse/explorer/providers/.

Source file: GrailsCommonNavigatorViewerSorter.java

  19 
vote

@Override public synchronized int compare(Viewer viewer,Object e1,Object e2){
  OrderingConfig orderingConfig=getOrderingConfig();
  int sortCat1=orderingConfig.getSortCat(e1);
  int sortCat2=orderingConfig.getSortCat(e2);
  if (sortCat1 > sortCat2)   return +1;
 else   if (sortCat2 > sortCat1) {
    return -1;
  }
 else {
    return javaComparator.compare(viewer,e1,e2);
  }
}
 

Example 38

From project gted, under directory /net.sf.gted.editor/src/net/sf/gted/editor/entry/master/.

Source file: EntrySorter.java

  19 
vote

/** 
 * Compare.
 * @param viewer the viewer
 * @param e2 the e2
 * @param e1 the e1
 * @return the int
 */
@SuppressWarnings("unchecked") @Override public int compare(final Viewer viewer,final Object e1,final Object e2){
  final POEntry entry1=(POEntry)e1;
  final POEntry entry2=(POEntry)e2;
  int sort;
switch (this.column) {
case 0:
    sort=Boolean.valueOf(entry1.isFuzzy()).compareTo(entry2.isFuzzy());
  return this.getSort(sort);
case 2:
if (entry1 instanceof POEntrySingular && entry2 instanceof POEntrySingular) {
  sort=this.getComparator().compare(((POEntrySingular)entry1).getMsgStr(),((POEntrySingular)entry2).getMsgStr());
  return this.getSort(sort);
}
return this.getSort(0);
default :
sort=this.getComparator().compare(entry1.getMsgId(),entry2.getMsgId());
return this.getSort(sort);
}
}
 

Example 39

From project incubator, under directory /net.karlmartens.ui/src/net/karlmartens/ui/widget/.

Source file: GridChooser.java

  19 
vote

@Override public boolean select(Viewer viewer,Object parentElement,Object element){
  if (element instanceof GridChooserItem) {
    return ((GridChooserItem)element).isSelected() == _selected;
  }
  return false;
}
 

Example 40

From project interactive-self-assessment, under directory /org.eclipse.ui.examples.javaeditor/javaeditorexamplesrc/org/eclipse/ui/examples/javaeditor/.

Source file: JavaContentOutlinePage.java

  19 
vote

public void inputChanged(Viewer viewer,Object oldInput,Object newInput){
  if (oldInput != null) {
    IDocument document=fDocumentProvider.getDocument(oldInput);
    if (document != null) {
      try {
        document.removePositionCategory(SEGMENTS);
      }
 catch (      BadPositionCategoryException x) {
      }
      document.removePositionUpdater(fPositionUpdater);
    }
  }
  fContent.clear();
  if (newInput != null) {
    IDocument document=fDocumentProvider.getDocument(newInput);
    if (document != null) {
      document.addPositionCategory(SEGMENTS);
      document.addPositionUpdater(fPositionUpdater);
      parse(document);
    }
  }
}
 

Example 41

From project ivyde, under directory /org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/.

Source file: PathEditor.java

  19 
vote

private void selectInProject(){
  ElementTreeSelectionDialog dialog=new ElementTreeSelectionDialog(getShell(),new WorkbenchLabelProvider(),new BaseWorkbenchContentProvider());
  dialog.setTitle("Select a file in the project:");
  dialog.setMessage("Select a file in the project:");
  dialog.addFilter(new ViewerFilter(){
    public boolean select(    Viewer viewer,    Object parentElement,    Object element){
      if (element instanceof IProject) {
        return ((IProject)element).getName().equals(project.getName());
      }
      if (defaultExtension == null) {
        return element instanceof IContainer;
      }
      return true;
    }
  }
);
  dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
  dialog.open();
  Object[] results=dialog.getResult();
  if ((results != null) && (results.length > 0) && (results[0] instanceof IResource)) {
    IPath path=((IResource)results[0]).getFullPath();
    setProjectLoc(path.removeFirstSegments(1).makeRelative().toString());
  }
}
 

Example 42

From project JGit, under directory /org.spearce.egit.ui/src/org/spearce/egit/ui/internal/components/.

Source file: RefSpecPanel.java

  19 
vote

private void createTable(final Group tableGroup){
  final Composite tablePanel=new Composite(tableGroup,SWT.NONE);
  final GridData layoutData=new GridData(SWT.FILL,SWT.FILL,true,true);
  layoutData.heightHint=TABLE_PREFERRED_HEIGHT;
  layoutData.widthHint=TABLE_PREFERRED_WIDTH;
  tablePanel.setLayoutData(layoutData);
  tableViewer=new TableViewer(tablePanel,SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER| SWT.V_SCROLL);
  ColumnViewerToolTipSupport.enableFor(tableViewer);
  final Table table=tableViewer.getTable();
  table.setLinesVisible(true);
  table.setHeaderVisible(true);
  createTableColumns(tablePanel);
  createCellEditors(table);
  tableViewer.setContentProvider(new IStructuredContentProvider(){
    public Object[] getElements(    final Object inputElement){
      return ((List)inputElement).toArray();
    }
    public void dispose(){
    }
    public void inputChanged(    Viewer viewer,    Object oldInput,    Object newInput){
    }
  }
);
  tableViewer.setInput(specs);
  tableViewer.setComparer(new IElementComparer(){
    public boolean equals(    Object a,    Object b){
      return a == b;
    }
    public int hashCode(    Object element){
      return element.hashCode();
    }
  }
);
}
 

Example 43

From project koneki.ldt, under directory /plugins/org.eclipse.koneki.ldt.remote.debug.ui/src/org/eclipse/koneki/ldt/remote/debug/ui/internal/launch/tab/.

Source file: LuaRemoteEnvironmentTab.java

  19 
vote

public void inputChanged(Viewer viewer,Object oldInput,Object newInput){
  if (newInput == null) {
    return;
  }
  if (viewer instanceof TableViewer) {
    TableViewer tableViewer=(TableViewer)viewer;
    if (tableViewer.getTable().isDisposed()) {
      return;
    }
    tableViewer.setComparator(new ViewerComparator(){
      public int compare(      Viewer iviewer,      Object e1,      Object e2){
        if (e1 == null) {
          return -1;
        }
 else         if (e2 == null) {
          return 1;
        }
 else {
          return ((EnvironmentVariable)e1).getName().compareToIgnoreCase(((EnvironmentVariable)e2).getName());
        }
      }
    }
);
  }
}
 

Example 44

From project libra, under directory /plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/overview/.

Source file: BundleInformationDetailsPart.java

  19 
vote

public void inputChanged(Viewer viewer,Object oldInput,Object newInput){
  if (newInput instanceof IServiceReference) {
    ref=(IServiceReference)newInput;
  }
 else {
    ref=null;
  }
}
 

Example 45

From project makegood, under directory /com.piece_framework.makegood.ui/src/com/piece_framework/makegood/ui/preferences/.

Source file: MakeGoodPropertyPage.java

  19 
vote

@Override public void widgetSelected(SelectionEvent e){
  ElementTreeSelectionDialog dialog=new ElementTreeSelectionDialog(contents.getShell(),new WorkbenchLabelProvider(),new WorkbenchContentProvider());
  dialog.setTitle(dialogTitle);
  dialog.setMessage(dialogMessage);
  dialog.setAllowMultiple(false);
  dialog.setComparator(new ViewerComparator(){
    @Override public int compare(    Viewer viewer,    Object e1,    Object e2){
      if (e1 instanceof IFile && e2 instanceof IFolder) {
        return 1;
      }
 else       if (e1 instanceof IFolder && e2 instanceof IFile) {
        return -1;
      }
      return super.compare(viewer,e1,e2);
    }
  }
);
  dialog.addFilter(viewerFilter);
  dialog.setInput(getProject());
  if (dialog.open() == Window.OK && dialog.getFirstResult() != null) {
    String text="";
    Object selectedResource=dialog.getFirstResult();
    if (selectedResource != null) {
      if ((selectedResource instanceof IFile) && (allowedResource & SELECTION_ALLOW_FILE) == SELECTION_ALLOW_FILE) {
        text=((IFile)selectedResource).getFullPath().toString();
      }
 else       if ((selectedResource instanceof IFolder) && (allowedResource & SELECTION_ALLOW_FOLDER) == SELECTION_ALLOW_FOLDER) {
        text=((IFolder)selectedResource).getFullPath().toString();
      }
    }
    subject.setText(text);
  }
}
 

Example 46

From project mylyn.builds, under directory /org.eclipse.mylyn.builds.ui/src/org/eclipse/mylyn/internal/builds/ui/editor/.

Source file: ArtifactsPart.java

  19 
vote

public void inputChanged(Viewer viewer,Object oldInput,Object newInput){
  if (newInput instanceof ArtifactFolder) {
    input=(ArtifactFolder)newInput;
  }
 else {
    input=null;
  }
}