コード例 #1
0
ファイル: Scopes.java プロジェクト: ranass/ReqCycle
 public static IScope getWorkspaceScope() {
   ResourceVisitor visitor = new ResourceVisitor();
   ZigguratInject.inject(visitor);
   try {
     ResourcesPlugin.getWorkspace().getRoot().accept(visitor);
   } catch (CoreException e) {
     e.printStackTrace();
   }
   return visitor.getResult();
 }
コード例 #2
0
ファイル: Scopes.java プロジェクト: ranass/ReqCycle
 public static IScope getSubTree(IResource r) {
   ResourceVisitor visitor = new ResourceVisitor();
   ZigguratInject.inject(visitor);
   try {
     r.accept(visitor);
   } catch (CoreException e) {
     e.printStackTrace();
   }
   return visitor.getResult();
 }
コード例 #3
0
 public RequirementScopeView() {
   ZigguratInject.inject(this);
 }
コード例 #4
0
  @Override
  public void createPartControl(Composite parent) {

    initInputs();

    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(new GridLayout(2, false));

    Label lblDataModel = new Label(composite, SWT.NONE);
    lblDataModel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    lblDataModel.setText("Data Model :");

    cvDataModel = new ComboViewer(composite, SWT.NONE);
    cvDataModel.getCombo().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    cvDataModel.setContentProvider(ArrayContentProvider.getInstance());

    // TODO : use scope generated label provider
    cvDataModel.setLabelProvider(
        new LabelProvider() {

          @Override
          public String getText(Object element) {
            if (element instanceof IDataModel) {
              return ((IDataModel) element).getName();
            }
            return "";
          }
        });

    cvDataModel.setInput(dataManager.getAllDataModels());

    //		refreshBtn = new Button(composite, SWT.PUSH);
    //		refreshBtn.setImage(Activator.getImageDescriptor("icons/refresh.gif").createImage());
    //
    //		refreshBtn.setToolTipText("Refresh View");

    Label lblScope = new Label(composite, SWT.NONE);
    lblScope.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    lblScope.setText("Scope :");

    cvScope = new ComboViewer(composite, SWT.NONE);
    cvScope.getCombo().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    cvScope.setContentProvider(ArrayContentProvider.getInstance());

    // TODO : use scope generated label provider
    cvScope.setLabelProvider(
        new LabelProvider() {

          @Override
          public String getText(Object element) {
            if (element instanceof Scope) {
              return ((Scope) element).getName();
            }
            return "";
          }
        });

    cvScope.setInput(scopes);

    viewer = new TreeViewer(composite, SWT.BORDER);
    viewer.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1));
    viewer.setContentProvider(
        new ITreeContentProvider() {

          @Override
          public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}

          @Override
          public void dispose() {}

          @Override
          public boolean hasChildren(Object element) {
            //				if (element instanceof AbstractElement) {
            //					 EList<EAttribute> eAllAttributes = ((AbstractElement)
            // element).eClass().getEAllAttributes();
            //					for (EAttribute eAttribute : eAllAttributes) {
            //						if	(((AbstractElement) element).eGet(eAttribute, true) != null) {
            //							return true;
            //						}
            //					}
            //				}
            return false;
          }

          @Override
          public Object getParent(Object element) {
            return null;
          }

          @Override
          public Object[] getElements(Object inputElement) {
            return ArrayContentProvider.getInstance().getElements(inputElement);
          }

          @Override
          public Object[] getChildren(Object parentElement) {
            //				Collection<Object> result = new ArrayList<Object>();
            //				if (parentElement instanceof AbstractElement) {
            //					EList<EAttribute> eAllAttributes = ((AbstractElement)
            // parentElement).eClass().getEAllAttributes();
            //					for (EAttribute eAttribute : eAllAttributes) {
            //						value = ((AbstractElement) parentElement).eGet(eAttribute, true);
            //					}
            //				}
            return null;
          }
        });
    viewer.setLabelProvider(
        new LabelProvider() {

          @Override
          public String getText(Object element) {
            return DataUtil.getLabel(element);
          }
        });
    viewer.setInput(requirements);

    int dndOperations = DND.DROP_COPY | DND.DROP_MOVE;

    Transfer[] transfers;
    transfers = new Transfer[] {PluginTransfer.getInstance()};

    DragRequirementSourceAdapter listener = new DragRequirementSourceAdapter(viewer);
    ZigguratInject.inject(listener);
    viewer.addDragSupport(dndOperations, transfers, listener);
    getViewSite().setSelectionProvider(viewer);

    makeActions();
    contributeToActionBars();
    hookListeners();
  }