org.eclipse.ui.views.properties.IPropertySource Java Examples

The following examples show how to use org.eclipse.ui.views.properties.IPropertySource. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CordovaPluginAdapterFactory.java    From thym with Eclipse Public License 1.0 6 votes vote down vote up
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public Object getAdapter(Object adaptableObject, Class adapterType) {
	if(!(adaptableObject instanceof HybridPluginFolder)) 
		return null;
	HybridPluginFolder pluginFolder = (HybridPluginFolder)adaptableObject;
	if(IPropertySource.class.equals(adapterType)){
		return new CordovaPluginProperties(pluginFolder);
	}
	if(IWorkbenchAdapter.class.equals(adapterType)){
		return new CordovaPluginWorkbenchAdapter();
	}
	if(IResource.class.equals(adapterType)){
		return pluginFolder.getFolder();
	}
	return null;
}
 
Example #2
Source File: ExtendedAdapterFactoryContentProvider.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public IPropertySource getPropertySource ( final Object object )
{
    // this one has priority in super class
    if ( object instanceof IPropertySource )
    {
        return (IPropertySource)object;
    }

    // allow the object to adapt to IPropertySource
    if ( object instanceof EObject && ( (EObject)object ).eClass () != null )
    {
        final IPropertySource propertySource = (IPropertySource)this.adapterFactory.adapt ( object, IPropertySource.class );
        if ( propertySource != null )
        {
            return propertySource;
        }
    }

    // fall back to default behavior
    return super.getPropertySource ( object );
}
 
Example #3
Source File: CordovaPlatformAdapterFactory.java    From thym with Eclipse Public License 1.0 6 votes vote down vote up
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public Object getAdapter(Object adaptableObject, Class adapterType) {
	if(!(adaptableObject instanceof HybridPlatformFolder)) 
		return null;
	HybridPlatformFolder platform = (HybridPlatformFolder)adaptableObject;
	if(IPropertySource.class.equals(adapterType)){
		return new CordovaPlatformProperties(platform);
	}
	if(IWorkbenchAdapter.class.equals(adapterType)){
		return new CordovaPlatformWorkbenchAdapter();
	}
	if(IResource.class.equals(adapterType)){
		return platform.getFolder();
	}
	return null;
}
 
Example #4
Source File: ContractConstraintExpressionWizardPage.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public boolean performFinish(final ContractConstraint constraintToUpdate,
        final IPropertySourceProvider propertySourceProvider) {
    final IPropertySource constraintPropertySource = propertySourceProvider.getPropertySource(constraintToUpdate);
    constraintPropertySource.setPropertyValue(ProcessPackage.Literals.CONTRACT_CONSTRAINT__EXPRESSION,
            constraint.getExpression());
    if (inputIndexer != null) {
        try {
            inputIndexer.join();
        } catch (final InterruptedException e) {
            BonitaStudioLog.error("Failed to join input indexer job.", e, ContractPlugin.PLUGIN_ID);
            return false;
        }
    }
    constraintPropertySource.setPropertyValue(ProcessPackage.Literals.CONTRACT_CONSTRAINT__INPUT_NAMES,
            constraint.getInputNames());
    return true;
}
 
Example #5
Source File: XdsElementAdapterFactory.java    From xds-ide with Eclipse Public License 1.0 6 votes vote down vote up
@Override
  public Object getAdapter(Object element, @SuppressWarnings("rawtypes") Class key) {
IXdsElement e = (IXdsElement)element;
  	if (IResource.class.isAssignableFrom(key)) {
  		return XdsElementUtils.adaptToResource(e, key);
  	}
  	
      if (IPropertySource.class.equals(key)) {
          return getProperties(XdsElementUtils.adaptToResource(e, IResource.class));
      }
      else if (IWorkbenchAdapter.class.equals(key)) {
          if (xdsWorkbenchAdapter == null) {
              xdsWorkbenchAdapter = new XdsWorkbenchAdapter();
          }
          return xdsWorkbenchAdapter;
      }
      else if (IContributorResourceAdapter.class.equals(key)) {
          return this;
      }
      
      return null;
  }
 
Example #6
Source File: UndoablePropertySheetEntry.java    From gef with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public void setValues(Object[] objects) {
	if (objects == null || objects.length == 0) {
		if (workbenchPart != null) {
			IPropertySource source = (IPropertySource) workbenchPart
					.getAdapter(IPropertySource.class);
			if (source != null) {
				// wrap source itself; it will be unwrapped by super
				// implementation and then passed to
				// #getPropertySource(Object), which will return it, so the
				// editable value can be retrieved from it
				objects = new Object[] { source };
			}
		}
	}
	super.setValues(objects);
}
 
Example #7
Source File: SVNAdapterFactory.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Method declared on IAdapterFactory.
    * Get the given adapter for the given object
 */
public Object getAdapter(Object adaptableObject, Class adapterType) {
	if (IWorkbenchAdapter.class == adapterType) {
		return getWorkbenchAdapter(adaptableObject);
	}

	if(IDeferredWorkbenchAdapter.class == adapterType) {
		 Object o = getWorkbenchAdapter(adaptableObject);
		 if(o != null && o instanceof IDeferredWorkbenchAdapter) {
		 	return o;
		 }
		 return null;
	}

	if (IPropertySource.class == adapterType) {
		return getPropertySource(adaptableObject);
	}
       
       if(IHistoryPageSource.class == adapterType) {
         return pageHistoryParticipant;
       }
       
	return null;
}
 
Example #8
Source File: PropertyPageAdapterFactory.java    From spotbugs with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Override
@SuppressWarnings("rawtypes")
public Object getAdapter(Object adaptableObject, Class adapterType) {
    if (adapterType == IPropertySheetPage.class) {
        if (adaptableObject instanceof BugExplorerView || adaptableObject instanceof AbstractFindbugsView) {
            return new BugPropertySheetPage();
        }
    }
    if (adapterType == IPropertySource.class) {
        if (adaptableObject instanceof BugPattern || adaptableObject instanceof BugInstance
                || adaptableObject instanceof DetectorFactory || adaptableObject instanceof Plugin
                || adaptableObject instanceof BugGroup
                || adaptableObject instanceof BugAnnotation) {
            return new PropertySource(adaptableObject);
        }
        IMarker marker = Util.getAdapter(IMarker.class, adaptableObject);
        if (!MarkerUtil.isFindBugsMarker(marker)) {
            return null;
        }
        return new MarkerPropertySource(marker);
    }
    return null;
}
 
Example #9
Source File: TraceProbeEventComponent.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public <T> T getAdapter(Class<T> adapter) {
    if (adapter == IPropertySource.class) {
        return adapter.cast(new TraceProbeEventPropertySource(this));
    }
    return null;
}
 
Example #10
Source File: AdaptableTextSelection.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
@SuppressWarnings("rawtypes")
public Object getAdapter(Class adapter)
{
	if (IPropertySource.class == adapter)
	{
		return new EditorPropertySource(this);
	}
	return null;
}
 
Example #11
Source File: ElementPropertySourceFactory.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
public Object getAdapter(Object adaptableObject, Class adapterType)
{
	if (adapterType.equals(IPropertySource.class))
	{
		if (adaptableObject instanceof ClassElement)
		{
			return new ClassElementPropertySource((ClassElement) adaptableObject);
		}
		if (adaptableObject instanceof FunctionElement)
		{
			return new FunctionElementPropertySource((FunctionElement) adaptableObject);
		}
		if (adaptableObject instanceof PropertyElement)
		{
			return new PropertyElementPropertySource((PropertyElement) adaptableObject);
		}
		if (adaptableObject instanceof JSElement)
		{
			return new JSElementPropertySource((JSElement) adaptableObject);
		}
		if (adaptableObject instanceof EventPropertyElement)
		{
			return new EventPropertyElementPropertySource((EventPropertyElement) adaptableObject);
		}
		if (adaptableObject instanceof EventElement)
		{
			return new EventElementPropertySource((EventElement) adaptableObject);
		}
		if (adaptableObject instanceof ClassGroupElement)
		{
			return new ClassGroupElementPropertySource((ClassGroupElement) adaptableObject);
		}
	}
	return null;
}
 
Example #12
Source File: KernelProviderComponent.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public <T> T getAdapter(Class<T> adapter) {
    if (adapter == IPropertySource.class) {
        return adapter.cast(new KernelProviderPropertySource(this));
    }
    return null;
}
 
Example #13
Source File: TraceLoggerComponent.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public <T> T getAdapter(Class<T> adapter) {
    if (adapter == IPropertySource.class) {
        return adapter.cast(new TraceLoggerPropertySource(this));
    }
    return null;
}
 
Example #14
Source File: TraceEventComponent.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public <T> T getAdapter(Class<T> adapter) {
    if (adapter == IPropertySource.class) {
        return adapter.cast(new TraceEventPropertySource(this));
    }
    return null;
}
 
Example #15
Source File: BaseEventComponent.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public <T> T getAdapter(Class<T> adapter) {
    if (adapter == IPropertySource.class) {
        return adapter.cast(new BaseEventPropertySource(this));
    }
    return null;
}
 
Example #16
Source File: TraceSessionComponent.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public <T> T getAdapter(Class<T> adapter) {
    if (adapter == IPropertySource.class) {
        return adapter.cast(new TraceSessionPropertySource(this));
    }
    return null;
}
 
Example #17
Source File: TraceDomainComponent.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public <T> T getAdapter(Class<T> adapter) {
    if (adapter == IPropertySource.class) {
        return adapter.cast(new TraceDomainPropertySource(this));
    }
    return null;
}
 
Example #18
Source File: TargetNodeComponent.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public <T> @Nullable T getAdapter(Class<T> adapter) {
    if (adapter == IPropertySource.class) {
        return adapter.cast(new TargetNodePropertySource(this));
    }
    return null;
}
 
Example #19
Source File: ERDiagramPropertySourceProvider.java    From erflute with Apache License 2.0 5 votes vote down vote up
@Override
public IPropertySource getPropertySource(Object object) {
    if (object instanceof ERDiagramEditPart) {
        final ERDiagram diagram = (ERDiagram) ((ERDiagramEditPart) object).getModel();
        return new ERDiagramPropertySource(diagram);
    } else if (object instanceof ERTableEditPart) {
        final ERTable table = (ERTable) ((ERTableEditPart) object).getModel();
        return new ERTablePropertySource(table);
    }

    return null;
}
 
Example #20
Source File: JavaElementAdapterFactory.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public Object getAdapter(Object element, Class key) {
	updateLazyLoadedAdapters();
	IJavaElement java= getJavaElement(element);

	if (IPropertySource.class.equals(key)) {
		return getProperties(java);
	} if (IResource.class.equals(key)) {
		return getResource(java);
	} if (fSearchPageScoreComputer != null && ISearchPageScoreComputer.class.equals(key)) {
		return fSearchPageScoreComputer;
	} if (IWorkbenchAdapter.class.equals(key)) {
		return getJavaWorkbenchAdapter();
	} if (IResourceLocator.class.equals(key)) {
		return getResourceLocator();
	} if (IPersistableElement.class.equals(key)) {
		return new PersistableJavaElementFactory(java);
	} if (IContributorResourceAdapter.class.equals(key)) {
		return this;
	} if (IContributorResourceAdapter2.class.equals(key)) {
		return this;
	} if (ITaskListResourceAdapter.class.equals(key)) {
		return getTaskListAdapter();
	} if (IContainmentAdapter.class.equals(key)) {
		return getJavaElementContainmentAdapter();
	} if (fIsTeamUILoaded && IHistoryPageSource.class.equals(key) && JavaElementHistoryPageSource.hasEdition(java)) {
		return JavaElementHistoryPageSource.getInstance();
	}
	return null;
}
 
Example #21
Source File: JavaElementAdapterFactory.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private IPropertySource getProperties(IJavaElement element) {
	IResource resource= getResource(element);
	if (resource == null)
		return new JavaElementProperties(element);
	if (resource.getType() == IResource.FILE)
		return new FilePropertySource((IFile) resource);
	return new ResourcePropertySource(resource);
}
 
Example #22
Source File: AbstractDebugTarget.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
public <T> T getAdapter(Class<T> adapter) {
    AdapterDebug.print(this, adapter);

    // Not really sure what to do here, but I am trying
    if (adapter.equals(ILaunch.class)) {
        return (T) launch;

    } else if (adapter.equals(IResource.class)) {
        // used by Variable ContextManager, and Project:Properties menu item
        if (file != null && file.length > 0) {
            return (T) FindWorkspaceFiles.getFileForLocation(file[0], null);
        } else {
            return null;
        }

    } else if (adapter.equals(org.eclipse.debug.ui.actions.IRunToLineTarget.class)) {
        return (T) this.getRunToLineTarget();

    } else if (adapter.equals(IPropertySource.class)) {
        return launch.getAdapter(adapter);

    } else if (adapter.equals(ITaskListResourceAdapter.class)
            || adapter.equals(org.eclipse.debug.ui.actions.IToggleBreakpointsTarget.class)) {
        return super.getAdapter(adapter);
    }

    AdapterDebug.printDontKnow(this, adapter);
    return super.getAdapter(adapter);
}
 
Example #23
Source File: PyVariable.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
public <T> T getAdapter(Class<T> adapter) {
    AdapterDebug.print(this, adapter);

    if (adapter.equals(ILaunch.class)) {
        return target.getAdapter(adapter);

    } else if (adapter.equals(org.eclipse.debug.ui.actions.IRunToLineTarget.class)) {
        return (T) this.target.getRunToLineTarget();

    } else if (adapter.equals(IScriptConsoleCodeGenerator.class)) {
        return (T) new PyConsoleCodeGeneratorVariable(this);

    } else if (adapter.equals(IPropertySource.class) || adapter.equals(ITaskListResourceAdapter.class)
            || adapter.equals(org.eclipse.ui.IContributorResourceAdapter.class)
            || adapter.equals(org.eclipse.ui.IActionFilter.class)
            || adapter.equals(org.eclipse.ui.model.IWorkbenchAdapter.class)
            || adapter.equals(org.eclipse.debug.ui.actions.IToggleBreakpointsTarget.class)
            || adapter.equals(IResource.class) || adapter.equals(org.eclipse.core.resources.IFile.class)) {
        return super.getAdapter(adapter);
    }

    //cannot check for the actual interface because it may not be available on eclipse 3.2 (it's only available
    //from 3.3 onwards... and this is only a hack for it to work with eclipse 3.4)
    if (adapter.toString().endsWith(
            "org.eclipse.debug.internal.ui.viewers.model.provisional.IElementContentProvider")) {
        return (T) new PyVariableContentProviderHack();
    }
    AdapterDebug.printDontKnow(this, adapter);
    return super.getAdapter(adapter);
}
 
Example #24
Source File: PyThread.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
public <T> T getAdapter(Class<T> adapter) {
    AdapterDebug.print(this, adapter);

    if (adapter.equals(ILaunch.class) || adapter.equals(IResource.class)) {
        return target.getAdapter(adapter);

    } else if (adapter.equals(ITaskListResourceAdapter.class)) {
        return null;

    } else if (adapter.equals(IDebugTarget.class)) {
        return (T) target;

    } else if (adapter.equals(org.eclipse.debug.ui.actions.IRunToLineTarget.class)) {
        return (T) this.target.getRunToLineTarget();

    } else if (adapter.equals(IPropertySource.class) || adapter.equals(ITaskListResourceAdapter.class)
            || adapter.equals(org.eclipse.debug.ui.actions.IToggleBreakpointsTarget.class)
            || adapter.equals(org.eclipse.ui.IContributorResourceAdapter.class)
            || adapter.equals(org.eclipse.ui.model.IWorkbenchAdapter.class)
            || adapter.equals(org.eclipse.ui.IActionFilter.class)) {
        return super.getAdapter(adapter);
    }
    //Platform.getAdapterManager().getAdapter(this, adapter);
    AdapterDebug.printDontKnow(this, adapter);
    // ongoing, I do not fully understand all the interfaces they'd like me to support
    return super.getAdapter(adapter);
}
 
Example #25
Source File: PyStackFrame.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
public <T> T getAdapter(Class<T> adapter) {
    AdapterDebug.print(this, adapter);

    if (adapter.equals(ILaunch.class) || adapter.equals(IResource.class)) {
        return thread.getAdapter(adapter);
    }

    if (adapter.equals(ITaskListResourceAdapter.class)) {
        return null;
    }

    if (adapter.equals(IDebugTarget.class)) {
        return (T) thread.getDebugTarget();
    }

    if (adapter.equals(org.eclipse.debug.ui.actions.IRunToLineTarget.class)) {
        return (T) this.target.getRunToLineTarget();
    }

    if (adapter.equals(IPropertySource.class) || adapter.equals(ITaskListResourceAdapter.class)
            || adapter.equals(org.eclipse.debug.ui.actions.IToggleBreakpointsTarget.class)) {
        return super.getAdapter(adapter);
    }

    AdapterDebug.printDontKnow(this, adapter);
    // ongoing, I do not fully understand all the interfaces they'd like me to support
    return super.getAdapter(adapter);
}
 
Example #26
Source File: CustomPropertyColumnLabelProvider.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
public String getText(Object object) {
    final IPropertySource propertySource = propertySourceProvider
            .getPropertySource(object);
    if (propertySource != null) {
        return super.getText(object);
    }
    return null;
}
 
Example #27
Source File: CustomAdapterFactoryContentProvider.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected IPropertySource createPropertySource(final Object object, IItemPropertySource itemPropertySource) {
    return new PropertySource(object, itemPropertySource){

        /*
         * (non-Javadoc)
         * @see org.eclipse.emf.edit.ui.provider.PropertySource#createPropertyDescriptor(org.eclipse.emf.edit.provider.IItemPropertyDescriptor)
         */
        @Override
        protected IPropertyDescriptor createPropertyDescriptor(IItemPropertyDescriptor itemPropertyDescriptor) {
            return new PropertyDescriptor(object, itemPropertyDescriptor) {

                /*
                 * (non-Javadoc)
                 * @see org.eclipse.emf.edit.ui.provider.PropertyDescriptor#createPropertyEditor(org.eclipse.swt.widgets.Composite)
                 */
                @Override
                public CellEditor createPropertyEditor(Composite composite) {
                    final Object feature = itemPropertyDescriptor.getFeature(this.object);
                    if (Objects.equals(feature, getCustomFeature())) {
                        return createCustomPropertyEditor(composite, object, itemPropertyDescriptor, getEditLabelProvider());
                    }
                    return super.createPropertyEditor(composite);
                }

            };
        }
    };
}
 
Example #28
Source File: ContactAdapterFactory.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public Object getAdapter(Object adaptableObject, @SuppressWarnings("rawtypes")
Class adapterType){
	if (adapterType == IPropertySource.class && adaptableObject instanceof ContactBean) {
		return new ContactPropertyAdapter((ContactBean) adaptableObject);
	}
	return null;
}
 
Example #29
Source File: ContactAdapterFactory.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
@SuppressWarnings("rawtypes")
@Override
public Class[] getAdapterList(){
	return new Class[] {
		IPropertySource.class
	};
}
 
Example #30
Source File: ERDiagramPropertySourceProvider.java    From ermaster-b with Apache License 2.0 5 votes vote down vote up
public IPropertySource getPropertySource(Object object) {
	if (object instanceof ERDiagramEditPart) {
		ERDiagram diagram = (ERDiagram) ((ERDiagramEditPart) object)
				.getModel();
		return new ERDiagramPropertySource(diagram);

	} else if (object instanceof ERTableEditPart) {
		ERTable table = (ERTable) ((ERTableEditPart) object).getModel();
		return new ERTablePropertySource(table);

	}

	return null;
}