小编uı6*_*uɐp的帖子

以编程方式触发RCP选择事件

在我的Eclipse RCP应用程序中,我使用了本文中描述的Selection Service .在一个视图中有一个TreeViewer注册为SelectionProvider:

getSite().setSelectionProvider(viewer);

另一个视图是从TreeViewer接收事件:

selectionListener = new ISelectionListener() {
  public void selectionChanged(IWorkbenchPart part, ISelection selection) {
    pageSelectionChanged(part, selection);
  }
 };
 getSite().getPage().addSelectionListener(selectionListener);
Run Code Online (Sandbox Code Playgroud)

一切正常,如果事件被触发我的正常鼠标点击.我想通过选择树中的项目以编程方式触发选择事件:

treeViewer.setSelection(new StructuredSelection(element),true);
Run Code Online (Sandbox Code Playgroud)

这不起作用.方法selectionChanged不在receiver-view中调用.这个论坛帖子讨论了这个问题.没有解决方案.

编辑

没有正确的方法来处理鼠标触发点击与编程选择相同的方式.单击鼠标可激活视图,而编程选择则不会.

我的解决方案是以与第一个视图相同的方式注册第二个Selection Service视图.之后,两个视图都直接从活动编辑器获取选择事件.

java jface eclipse-rcp

23
推荐指数
3
解决办法
2万
查看次数

如何覆盖PrimeFaces的样式表?

简单地说,我试图通过FireBug在生成的HTML中查看组件的名称,之后我在JSF项目中手动定义的css中更改它,但无法覆盖PrimeFaces的CSS定义.提前感谢任何想法.

css jsf primefaces

12
推荐指数
2
解决办法
4万
查看次数

基于RCP的应用程序的P2更新失败

我试图通过P2更新站点更新基于Eclipse-RCP-3.5的应用程序.该应用程序包含两个功能.

产品是由Eclipse Buckminster.创建P2更新站点是产品构建的一部分.

通过菜单启动更新时:Update -> Check for Updates将显示一个消息框:There is nothing to update.

当我尝试菜单时:Update -> Install New Software...并选择相同的更新站点,报告错误:

Your original request has been modified.
  "Verinice Anwendung" is already installed, so an update will be performed instead.
  "verinice server Feature" is already installed, so an update will be performed instead.
Cannot complete the install because of a conflicting dependency.
  Software being installed: Verinice Anwendung 1.1.1.201007130142 (sernet.gs.ui.rcp.main.feature.feature.group 1.1.1.201007130142)
  Software currently installed: verinice 1.1.1 (sernet.gs.ui.rcp.main.product 1.1.1)
  Only …

java rcp p2 eclipse-rcp buckminster

8
推荐指数
1
解决办法
1067
查看次数

使用svn2git SVN到GIT迁移失败

我正在尝试使用svn2git将存储库从SVN迁移到GIT .它是一个开源项目,公共SVN存储库Url是:http://svn.verinice.org/svnroot/.随意测试迁移...

SVN存储库结构是:

  • 分支机构
  • TAGS
  • 树干

我使用以下命令来克隆此Repo:

svn2git http://svn.verinice.org/svnroot 
  --trunk TRUNK 
  --branches BRANCHES 
  --tags TAGS
Run Code Online (Sandbox Code Playgroud)

但是此命令仅迁移一个分支而根本不迁移任何标记.我使用这些命令来检查结果:

[user@forge git-repo]# git branch -a
* master
  springy
  remotes/springy
[user@forge git-repo]# git tag -l
[user@forge git-repo]# 
Run Code Online (Sandbox Code Playgroud)

如何迁移所有分支和标签?谢谢你的帮助!

更新:

使用参数--authors authors-file.txt并将名称和电子邮件地址添加到git配置svn2git后工作正常:

 git config --global user.name "your name"
 git config --global user.email "your@email.com"
Run Code Online (Sandbox Code Playgroud)

您必须在authors-file.txt中每个 SVN用户添加一行:

 svn-user-name = Full Name <email@address.com>
Run Code Online (Sandbox Code Playgroud)

git branch -agit tag -l现在返回所有分支和标签.

svn git

7
推荐指数
1
解决办法
9562
查看次数

如何设置 Eclipse/RCP 装饰器的颜色?

我通过plugin.xml在 Eclipse/RCP 应用程序中向我的树查看器项添加了一个装饰器:

<extension point="org.eclipse.ui.decorators">
      <decorator
            adaptable="true"
            class="sernet.verinice.samt.rcp.TopicDecorator"
            id="sernet.verinice.samt.rcp.TopicDecorator"
            label="ISA Topic decorator"
            lightweight="true"
            location="BOTTOM_LEFT"
            state="true">
         <enablement>
            <objectClass name="sernet.verinice.model.samt.SamtTopic"/>        
         </enablement>
      </decorator>
Run Code Online (Sandbox Code Playgroud)

在装饰器类中,我设置了可以正常工作的装饰后缀:

public class TopicDecorator extends LabelProvider implements ILightweightLabelDecorator, {
  ControlMaturityService maturityService = new ControlMaturityService();    
  @Override
  public void decorate(Object element, IDecoration decoration) {
     decoration.addSuffix( new StringBuilder().append(" [")
       .append(maturityService.getWeightedMaturity((IControl)element))
       .append("]").toString() );   
     decoration.setForegroundColor(new Color(Display.getCurrent(), 150,90,90));     
   }
Run Code Online (Sandbox Code Playgroud)

如您所见,我还尝试设置没有效果的足够的前景色。后缀与树中的标签颜色相同:黑色。

如何设置装饰后缀的颜色?

java eclipse rcp

5
推荐指数
1
解决办法
3714
查看次数

测试对@transactional @Async方法的调用的JUnit导致超出锁定等待超时

我正在尝试测试异步运行的服务方法(@Async).

这是异步方法:

@Async
@Transactional(propagation=Propagation.SUPPORTS, isolation = Isolation.READ_UNCOMMITTED)
public Future<UserPrefs> checkLanguagePreference(long id) {

    UserPrefs prefs = prefsDao.retrieveUserPreferences(id);
    if(prefs == null || !StringUtils.hasLength(prefs.getLanguage())) {
        //Save a new sms-command object
        SmsBean command = SmsHelper.buildSmsCommand();
        if(! smsDao.checkSameCommandExists(id, command)) {

            smsDao.saveSms(id, new SmsBean[] {command}); //Will wait until Lock wait timeout
        }
    }
    return new AsyncResult<UserPrefs>(prefs);
}
Run Code Online (Sandbox Code Playgroud)

这是调用异步的测试方法:

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(location = "...")
@TransactionConfiguration(transactionManager = "txManager", defaultRollback = false)
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
@TestExecutionListeners( {  DependencyInjectionTestExecutionListener.class,
  DirtiesContextTestExecutionListener.class,
  TransactionalTestExecutionListener.class })
public class MessagingServiceTest {

   @Before
   public void setUp() { …
Run Code Online (Sandbox Code Playgroud)

java mysql junit spring hibernate

5
推荐指数
1
解决办法
8229
查看次数

Primefaces组件CSS自定义

正如我在primefaces文档中看到的,

    1) To change the font-size of PrimeFaces components globally, use the `.ui-widget` style class. 
       An example with 12px font size.

        .ui-widget,
        .ui-widget .ui-widget {
               font-size: 12px !important;
         }
Run Code Online (Sandbox Code Playgroud)

我有2个问题:

  1. 为什么.ui-widget在上面的代码中写了三次?

  2. 对于tabView我想要以不同方式自定义其标题背景颜色的两个不同实例,但我找不到这样做的方法.这甚至可能吗?

css jsf primefaces

5
推荐指数
1
解决办法
2万
查看次数

JPA中@Access annoation的用途是什么意思在实体级别?

我在实体中看到了这个@ javax.persistence.Access(javax.persistence.AccessType.FIELD).这是什么意思?是否真的需要为实体声明@Access.

java jpa java-ee

5
推荐指数
1
解决办法
3343
查看次数

Spring Data Neo4j 4中的DynamicProperties

我使用DynamicProperties春数据的Neo4j 3.x中的 我在Spring Data Neo4j 4.0.0.M1(SDN4)中缺少这个类.我在SDN4中有一个新概念来存储动态属性值吗?

DynamicProperties上的属性@NodeEntity存储其所有属性动态底层节点本身上.

DynamicProperties成员的键/值对存储在节点上,其键前缀为DelegatingFieldAccessorFactory#getNeo4jPropertyName(Field)返回的属性名称.

NodeEntity
 class Person {
     String name;
     DynamicProperties personalProperties = new DynamicPropertiesContainer();
 }

 Person p = new Person();
 p.persist();
 p.personalProperties.setProperty("ZIP", 8000);
 p.personalProperties.setProperty("City", "Zuerich");
Run Code Online (Sandbox Code Playgroud)

导致具有以下属性的节点:

 "personalProperties-ZIP" => 8000
 "personalProperties-City" => "Zuerich"
Run Code Online (Sandbox Code Playgroud)

java spring neo4j spring-data-neo4j

5
推荐指数
1
解决办法
711
查看次数

PKCS#11驱动程序会提示输入每个密钥的PIN

我使用西门子的CardOS API驱动程序作为PKCS#11驱动程序从PKI卡加载证书,如下所示:

char[] pin = "123456".toCharArray();
KeyStore.PasswordProtection pp = new KeyStore.PasswordProtection(pin);
KeyStore keyStore = KeyStore.Builder.newInstance("PKCS11", Security.getProvider("SunPKCS11-verinice"), pp).getKeyStore();
keyStore.load(null,pin);
keyStore.getKey("key 1", pin);
keyStore.getKey("key 2", pin);
Run Code Online (Sandbox Code Playgroud)

尽管我将其作为参数传递,但驱动程序会提示输入每个密钥的PIN.有没有其他方法可以通过API传递PIN码?我可以激活任何"PIN缓存"吗?

java pki pkcs#11

4
推荐指数
2
解决办法
3772
查看次数

MongoDB,Java,按第一个数组条目排序

我正在尝试通过Java API在MongoDB上执行查找后对值进行排序.结果列表包含以下条目:

{
"_id": "P17-223",
"property": "P17",
"itemid": 223,
"labels": [
  {
    "language": "en",
    "value": "Greenland"
  },
  {
    "language": "es",
    "value": "Groenlandia"
  },
  {
    "language": "de",
    "value": "Grönland"
  }
]
Run Code Online (Sandbox Code Playgroud)

}

我想按数组标签的第一个条目排序:

  DBCursor cursor = getCollection().find(query);
  BasicDBObject orderBy = new BasicDBObject("labels[0].value", 1);
  cursor.sort(orderBy);
Run Code Online (Sandbox Code Playgroud)

此代码不对游标值进行排序.你能帮助我吗?

java mongodb aggregation-framework

3
推荐指数
3
解决办法
1882
查看次数